diff options
| author | KATO Takenori <kato@FreeBSD.org> | 2000-03-20 12:14:12 +0000 |
|---|---|---|
| committer | KATO Takenori <kato@FreeBSD.org> | 2000-03-20 12:14:12 +0000 |
| commit | de6c289a4d87bcdcced75d5d794133342caca93b (patch) | |
| tree | 9610abbb38b4c9848908f7f525da05196a72ce71 /sys | |
| parent | c1765799d9056df0c85e4ae04318c87ca5d68915 (diff) | |
Notes
Diffstat (limited to 'sys')
44 files changed, 0 insertions, 10486 deletions
diff --git a/sys/pc98/boot/Makefile b/sys/pc98/boot/Makefile deleted file mode 100644 index 904c72fd7786..000000000000 --- a/sys/pc98/boot/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= biosboot kzipboot netboot rawboot - -.include <bsd.subdir.mk> diff --git a/sys/pc98/boot/Makefile.inc b/sys/pc98/boot/Makefile.inc deleted file mode 100644 index a3603a63e939..000000000000 --- a/sys/pc98/boot/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ - -BINDIR?= /usr/mdec -CFLAGS+= -aout -.if exists(${.CURDIR}/../../../../include) -CFLAGS+= -nostdinc -I${.CURDIR}/../../../../include -.endif -CFLAGS+= -I${.CURDIR}/../../.. -I${.OBJDIR} -CLEANFILES+= machine - -.if defined(SRCS) -${SRCS:M*.[sS]:R:S/$/.o/g} ${SRCS:M*.c:R:S/$/.o/g}: machine -${SRCS:M*.cc:R:S/$/.o/g} ${SRCS:M*.C:R:S/$/.o/g}: machine -${SRCS:M*.cxx:R:S/$/.o/g} ${SRCS:N*.h:R:S/$/.o/g}: machine -.endif -.if defined(OBJS) -${OBJS}: machine -.endif - -beforedepend: machine -machine: - ln -s ${.CURDIR}/../../../i386/include ${.OBJDIR}/machine diff --git a/sys/pc98/boot/biosboot/Makefile b/sys/pc98/boot/biosboot/Makefile deleted file mode 100644 index 060681653f56..000000000000 --- a/sys/pc98/boot/biosboot/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# $FreeBSD$ -# - -PROG= boot -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c disk.c sys.c - -BINMODE= 444 -CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ - -DPC98 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= ${CWARNFLAGS} - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -#BOOT_COMCONSOLE_PORT?=0x30 -BOOT_COMCONSOLE_PORT?=0x238 -BOOT_COMCONSOLE_CLK?=16 -BOOT_COMCONSOLE_MODE=0x0c -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \ - -DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \ - -DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE} - -# feature not implemented -BOOT_COMCONSOLE_SPEED?=9600 -CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED} - -# 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 -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of -# 1:wd(1,a). If `da' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a). - -CLEANFILES+= boot.nohdr boot.strip boot1 boot2 sizetest -LDFLAGS+= -N -T 0 -nostdlib -NOSHARED= YES -NOMAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.strip: boot - cp -p boot boot.strip - strip -aout boot.strip - size -aout boot.strip - -boot.nohdr: boot.strip - dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b - ls -l boot.nohdr - -boot1: boot.nohdr - dd if=boot.nohdr of=boot1 bs=512 count=1 - -boot2: boot.nohdr - dd if=boot.nohdr of=boot2 bs=512 skip=1 - @dd if=boot2 skip=14 of=sizetest 2> /dev/null - @if [ -s sizetest ] ; then \ - echo "boot2 is too big" >&2 ; \ - rm boot2 ; \ - exit 2 ; \ - fi - -all: boot1 boot2 - -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - boot1 boot2 ${DESTDIR}${BINDIR}/ - -install-boothelp: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ - ${.CURDIR}/boot.help ${DESTDIR}/ - -.include <bsd.kern.mk> -.include <bsd.prog.mk> diff --git a/sys/pc98/boot/biosboot/README.386BSD b/sys/pc98/boot/biosboot/README.386BSD deleted file mode 100644 index 3d7c09da5968..000000000000 --- a/sys/pc98/boot/biosboot/README.386BSD +++ /dev/null @@ -1,172 +0,0 @@ -Note: all my original references to 386BSD also refer to freeBSD and NetBSD -which in some ways are derived from 386BSD. --julian@freebsd.org - -This Boot code is different from the original boot code that came with -386BSD in that it uses the BIOS to load the kernel and to provide all i/o -services. The advantage ofthis is that the same boot code exactly, can run -on any device that is supported by the BIOS. (That's most of them) -This is important for the 'generic scsi' project because it means we can -write drivers for new scsi adapters without having to develop an new -set of boot blocks for each. - -At this point you should read the first part of README.MACH... come back here -when you have done that: - -In normal operation, when co-existing with other operating systems, the -following operations occur: - -1/ the BIOS loads the first block of the disk (called the Master Boot Record -or MBR) and if it has the correct magic numbers, jumps into it: - -2/ The MBR code, looks at the Partition table that is embedded within it, -to determine which is the partition to boot from. If you install the -boot manager when FreeBSD is first installed, it will also give you a nice -menu for switching between operating systems. - -3/ The MBR will load the first record of the selected partition and -if it has (the same) magic numbers, jumps into it. In 386bsd this is the -first stage boot, (or boot1) it is represented in /usr/mdec by -wdboot, asboot and daboot. If the disk has been set up without DOS partitioning -then this block will be at block zero, and will have been loaded directly by -the BIOS. This is the usual case with floppies. - -4/ Boot1 will look at block0 (which might be itself if there are no DOS -partitions) and will find the 386bsd partition, - -Boot 1 also contains a compiled in DOS partition table -(in case it is at block 0), which contains a 386bsd partition starting -at 0. This ensures that the same code can work whether or not -boot1 is at block 0. - -4A/ IF the NAMEBLOCK option is compiled into the bootcode, then the -boot1 code will load and examine block1 (usually unused) and -look for a default boot string to use later (if the correct magic number -is present). If the option NAMEBLOCK_WRITEBACK is also defined, then -it will zero out that name after finding it, and write the block back, -having "used up" that name. The block may contain multiple different -boot strings which will be "used up" one after the other (one per boot) -They are set using the "nextboot" utility. - -4B/ Using the information found in step 4, regarding the start position -of the BSD partition, boot1 will load the first 16 sectors of that partition, -to around 0x10000 (64k) and will jump into it at the appropriate entry point. -Since boot1 and boot2 were compiled together as one file and then split -later, boot1 knows the exact position within boot2 of the entry point. - -5/ Boot2 asks the user for a boot device, partition and filename, and then -loads the MBR of the selected device. This may or may not be the device -which was originally used to boot the first MBR. The partition table -of the new MBR is searched for a 386bsd partition, and if one is found, -that is then in turn searched for the disklabel. This could all be on the -second disk at this point, if the user selected it. If the user makes no -actions then a default string will be used. - -If the NAMEBLOCK option is used, then the default string may have been -loaded from block2. If none was found then a compiled in default will be used. - -6/On finding the disklabel, on the disk the user spacified, boot2 can find -the correct unix partition within the 386bsd partition, and using cutdown -filesystem code, look for the file to boot (e.g., 386bsd). - -7/ Boot2 loads this file starting at the location specified by the a.out header, -(see later) and leaps into it at the location specified in he header. - -if the file does not exist or cannot be loaded, boot2 goes back to step 5. - -386bsd is now running and will hopefully start vm etc. and get to multi-user -mode. - -########################################################################## -During all these steps, all i/o is performed using the BIOS. This has a number -of side effects: - -1/ Since BIOS disk calls are specified in terms of cylinder,head and sector, -and the BIOS read the disk information from either the CMOS or from some other -location which is un-available to us, we must use the cyl,head,sec information -that is given in the MBR, rather than the start address in the MBR, because -we cannot guarentee that we can corectly calculate C,H,S from the start address. - -Therefore, the C,H,S information in the MBR must be as correct for this boot -to work as it would be for DOS to boot. For example, adaptec BIOS routines -assume a layout of 64 heads and 32 sectors giving 1MB per ficticious cylinder. -You must use these figures to calculate the correct values. Luckily, the DOS -fdisk program will do all this for you if you tell it to give you a DOS -partition, and you can change it to a 386BSD partition later. If you use -no DOS partitioning, then the compiled in table in Boot1 will do just fine. - -If you want to do it by hand remember that BIOS counts sectors starting at 1. -(cylinders and heads start at 0 (??)) - -2/ you cannot overwrite the bottom 4k of ram until you have finished ALL -bios calls, as BIOS uses this area as scratch memory. -This is no longer really a problem as we no-longer support loading the kernel -at location 0. - -3/ Since BIOS runs in REAL mode, and Boot2 runs in protected mode, -Boot 2 switches back to real mode just before each BIOS call and then -back to protected mode on each return. Touch this at your peril.! - -######################################################################### -In answering the prompt from Boot2: -you can, -1/ leave it alone. It will boot the indicated file from the first -partition of the first drive seen by the BIOS (C:) -If the NAMEBLOCK option is in use, the default name might be taken from block1 -(2nd block) on that drive (the drive on which boot 1 was loaded). - -2/ enter only "-s" to boot the default to single user mode - -3/ enter only a filename (optionally with -s) to boot that kernel, - -4/ enter a whole line of the form shown in the prompt. This allows you to -boot some other partition, possibly on the second drive, as root. - - -########################################################################## -In the case you have several drives the same type (all scsi or all IDE/ESDI), - wd(0,a)xxx -will boot xxx from drive 0, a partition. - wd(1,a)xxx -will boot xxx from drive 1, a partition. - -similarly for da and for higher drive numbers (if the BIOS supports them). - -if you have one or more wd drives and one or more scsi drives, then you -MUST specify the BIOS drive number for booting the scsi drives: - 2:da(0,a)xxx -will boot xxx from scsi drive 0, a partition, provided `2' is the correct -BIOS drive number for da0. - -otherwise the following will happen: - -with wd0 and da0, you specify da1 or wd1 to indicate the 2nd drive. -it boots the kernel correctly, then tells the kernel to use da1 as root. -you however may not have an da1, and problems arise. - -Whether da or wd is specified to the kernel is read from the disklabel, -so ensure that all SCSI disks have type SCSI in their disklabel or the -boot code will assume they are ESDI or IDE. (Remember, because it is -working through the BIOS it has ho idea what kind of disk it is. - -########################################################################## -Installing: -The makefile supplied has a target install which will create the -files wdboot,bootwd ,daboot and bootda in /usr/mdec. -BEWARE these will overwrite the existing wdboot and bootwd. (so back -them up) - -there are also targets wd and da which wil only do one of them - -The commented out targets wd0 and da0 are examples of how to -load the new bootblocks, however,make sure you change the -device type and label to suit your drive if you uncomment them. -(see 'man disklabel') - -If you already have made partitions using the old bootblocks -these should install painlessly. - -Before you do this ensure you have a booting floppy with correct -disktab and bootblock files on it so that if it doesn't work, you can -re-disklabel from the floppy. - -$FreeBSD$ diff --git a/sys/pc98/boot/biosboot/README.MACH b/sys/pc98/boot/biosboot/README.MACH deleted file mode 100644 index 73d090a404bd..000000000000 --- a/sys/pc98/boot/biosboot/README.MACH +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:33:55 rpd - * $FreeBSD$ - */ - -********NOTE: This is not all relevant to the 386BSD version********** - - AT386 Protected Mode Bootstrap Loader - ===================================== - -1. Overview of Startup - ------------------- - - After the system is rebooted, the BIOS bootstrap routine reads Sector - 1, Track 0 into memory at location 0000:7C00H. If location 0000:7DFEH - (last two bytes of that sector) contains the value AA55H, the BIOS - bootstrap routine will transfer control to 0000:7C00H. Otherwise, the - boot code in that sector is bad and the boot routine stops. - - For DOS compatibility reason, one extra stage of boot is required if - the boot device is a hard disk. The first sector of the hard disk will - contain the MOS-DOS boot code and a boot record partition table. - When this sector is loaded into 0000:7C00H, it will relocate itself - to somewhere else and then load the first sector of the active - partition into 0000:7C00H. Both UNIX and DOS use the command "fdisk" -[ 386bsd does not have an 'fdisk' (yet) ] - to install this first sector into the hard disk and to manipulate - the hard disk partitions. - - - -2. The First Stage Bootstrap Loader - -------------------------------- - - After startup, the first stage boot is loaded at 0000:7C00H. This - first stage boot will load itself and the second stage boot into - memory at location 0000:1000H. For floppy disks, the first cylinder - is reserved as the boot cylinder, and the boot code (first and second) - will be loaded from there. Currently, only double sided, high density - (15 sectors per track) floppies are supported. For hard disks, the - first 29 sectors of the active partition is reserved for boot code - which will be loaded by the first stage boot. All the disk types - recognized by BIOS are supported by this bootstrap loader. -[for 386bsd we load the second stage booter to 9000:0] - - - -3. The Second Stage Bootstrap Loader - -------------------------------- - - After the boot code is loaded, the control is passed to the second - stage bootstrap loader "boot2()". In order to be able to load the - big kernel image (bigger than 512K or 640K, depends on the memory - configuration), the second stage boot loader will run on the protected - mode. This bootstarp loader does not have any stand alone device - drivers, all the I/O's are through the BIOS calls. Since the first - stage boot code will no longer be used at this moment, the memory - location of the first stage boot code (0000:1000H to 0000:1200H) will - be used as an internal buffer for BIOS calls. Immediately after this - internal buffer is the GDT table for the second stage boot loader. - Since this boot loader needs to switch back and forth between protected - and real mode in order to use BIOS calls, the limit of the boot code - and boot data segments must not be greater than 64K. - - The boot loader loads the kernel image at memory location above 1 MB - to skip the memory hole between 521K/640K and 1MB. After the kernel - is loaded, the boot loader stores the information in the stack and - then passes control to kernel. Currently, the three information passed - fromm the boot loader to the kernel are type of the boot device, size - of the base memory and size of the extended memory. - -[ 386bsd receives: howto, bootdev] - -[ 386bsd is loaded where-ever the "MByte" bits of the load address specify, -so if you link it for FE100000 it will load to 1MB, but if you link -it for FE000000 it will load ad 0MB] - -[for machines with only 512KB normal ram the kernel will need to be linked -for 1MB and the bootblocks modified to run below 512KB. (8000:0)] - - -4. The UNIX Startup - ---------------- - - Since the boot loader loads the kernel image at memory location above - 1MB, the kernel has to start as protected mode. In addition, the - link editor description file (vuifile) has to indicate that - the text and data segments start above 1MB. Also, the boot loader - passes the infomation to the kernel through the stack. - -[MOST of what is mentionned below is NOT relevant to 386bsd] - -5. Disk Layout and Bad Block Handling - --------------------------------- - - The System V/386 Release 3.2 (AT) disk layout will be used as the disk - layout for the MACH System on the AT platform. - - This disk layout is as follows: - - * Reserve the first sector of cylinder 0 for the DOS boot record which - contains the master boot code (446 bytes) and the partition table. - (Refer to DOS Technical Reference Manual page 9-6 to 9-10). - - * Reserve the first 29 sectors of the UNIX partition for the first - and the second stage bootstrap. - - * Reserve the 30th sector of the UNIX partition for the pdinfo and - the vtoc tables. - - * Reserve the 31st to the 34th sectors of the UNIX partition for the - bad track and the bad block mapping tables. - - * Reserve up to 253 consecutive tracks when required, beginning with - the 35th sector of the UNIX partition, for alternate tracks. - - * Reserve up to 253 consecutive blocks, beginning with the first - sector after the alternate tracks area, for alternate blocks. - - SEC - 1 - ---------------------------------------------------- - | X | | CYL 0, TRK 0 - ---------------- .......... -------------------- - | .......... | - ---------------- .......... -------------------- - | .......... | - =============================================================== - ^ | BOOTSTRAP | CYL N, TRK M - | ---------------------------------------------------- - | | |30 |31 |32 |33 |34 | - ---------------------------------------------------- --- - U | .......... | ^ - N ---------------- .......... --------------------- | - I | .......... | Alternate Tracks - X ---------------- .......... --------------------- | - | .......... | V - P ---------------------------------------------------- --- - A | .......... | ^ - R ---------------- .......... --------------------- | - T | .......... | Alternate Blocks - I ---------------- .......... -------------------- | - T | .......... | V - I ---------------------------------------------------- --- - O | Unix root partition starts from here | - N ---------------- ----------------- - | | - ---------------------------------------------------- - | | - ---------------------------------------------------- - | | - | --------------------------------------------------- - | | | - | ---------------------------------------------------- - V | | - =============================================================== - | ........ | - --------------- ........ -------------- - | ........ | - ---------------------------------------------------- - - - The bad block handling mechanism is as follows: - - * Use the alternate track in the alternate tracks area if the - track containing the target sector is bad. - - * Use the alternate block in the alternate blocks area if the - target sector is bad. - - - - -6. How to make: - ----------- - - Since the kernel image is loaded above 1 MB, the kernel must start - as protected mode. This means that this bootstrap loader will work - only when the corresponding changes on the kernel startup code are done. - - The make command to generate this bootstrap loader is: - - make -f boot.mk fdboot (floppy boot loader) - make -f boot.mk hdboot (wini boot loader) -[to make 386bsd bootblocks "make da wd" (warning: they will be installed -in /dev/mdec.. take backups)] diff --git a/sys/pc98/boot/biosboot/README.serial b/sys/pc98/boot/biosboot/README.serial deleted file mode 100644 index 7edcdeec060c..000000000000 --- a/sys/pc98/boot/biosboot/README.serial +++ /dev/null @@ -1,196 +0,0 @@ - - SERIAL CONSOLE USAGE NOTES - Written by - Bill Paul <wpaul@ctr.columbia.edu> - Revised for 3.0-CURRENT by - Kazutaka Yokota <yokota@zodiac.mech.utsunomiya-u.ac.jp> - -The FreeBSD boot block can now be used to boot FreeBSD on a system with -only a dumb terminal on a serial port as a console. This feature -is provided for the benefit of people who wish to install FreeBSD on -dedicated file/compute/terminal server machines that have no keyboard -(or monitor) attached, just as is possible with Sun workstations and -servers. People who don't need this extra functionality shouldn't notice -the changes at all (unless I've screwed something up horribly). - -To boot FreeBSD in serial console mode, you must do the following: - -- UNPLUG YOUR KEYBOARD. Most PC systems probe for the keyboard during the - Power-On Self-Test (POST) and will generate an error if the keyboard - isn't detected. Some BIOSes may be set to ignore this error. Many other - machines will pause the boot process and wait for you to reattach the - keyboard and press a key before proceeding any further. Consult the manual - of your motherboard to see how it responds to the error and how to - set the BIOS to ignore the error. If your computer complains about - the lack of a keyboard but boots anyway, then you don't have to do - anything special. (One machine with a PHOENIX BIOS that I have here - merely says 'Keyboard failed' then continues to boot normally.) If your - machine complains loudly about the lack of a keyboard and won't continue - to boot until you plug it back in, you'll have to go into your CMOS - configuration menu and change the 'Keyboard' setting to 'Not installed' - in order to bypass the keyboard probe. - - NOTE #1: - Setting the keyboard to 'Not installed' in the CMOS configuration - does *NOT* mean that you won't be able to use your keyboard. All this - does is tell the BIOS not to probe for a keyboard at power-on so that - it won't bitch and moan if the keyboard isn't plugged in. You can leave the - keyboard plugged in even with this flag set to 'Not installed' and the - keyboard will still work. I repeat: changing the CMOS 'keyboard' setting - to 'Not installed' only disables the BIOS's keyboard probe; it does - *NOT* actually disable the keyboard. - - NOTE #2: - If your system has a PS/2 mouse, chances are very good that you will - need to unplug your mouse as well as your keyboard. This is because - PS/2 mice share some hardware with the keyboard, and leaving the mouse - plugged in can fool the keyboard probe into thinking the keyboard is - still there. I have access to a Gateway 2000 Pentium 90Mhz system with - an AMI BIOS that behaves this way. In general this is not a problem - since the mouse isn't much good without the keyboard anyway. - -- PLUG A DUMB TERMINAL INTO COM1. If you don't have a dumb terminal, you - can use an old PC/XT with a modem program, or the serial port on - another UNIX box. If you don't have a COM1, get one. At this time, - there is no way to select a port other than COM1 for the boot blocks - without recompiling the boot blocks. If you're already using COM1 for - another device, you'll have to temporarily remove that device and - install a new boot block and kernel once you get FreeBSD up and running. - (It is assumed that COM1 will be available on a file/compute/terminal - server anyway; if you really need COM1 for something else (and you can't - switch that something else to COM2), then you probably shouldn't even - be bothering with all this in the first place.) - - NOTE #1: - The serial port settings are hardcoded to 9600 baud, 8 bits, no parity, - 1 stop bit, by default. If you wish to change the speed, you need to - recompile at least the boot blocks. Add the following line to - /etc/make.conf and compile new boot blocks: - - BOOT_COMCONSOLE_SPEED=115200 - - If the serial console is configured in some other way than by booting with - -h, or if the serial console used by the kernel is different from the one - used by the boot blocks, then you must also add the following option to the - kernel configuration file and compile a new kernel: - - options CONSPEED=115200 - - NOTE #2: - In addition to a serial cable, you will need a null modem adapter - in order to connect the terminal to the PC's serial port. If you don't - have one, go to Radio Shack and buy one: they're cheap. - - NOTE #3: - If you wish to drop into the kernel debugger from the serial console - (useful for remote diagnostics, but also dangerous if you generate a - spurious BREAK on the serial port!) then you should compile your kernel - with the following options: - - options BREAK_TO_DEBUGGER - options DDB - - -- MAKE SURE THE CONFIGURATION FILE OF YOUR KERNEL HAS APPROPRIATE FLAGS - SET FOR COM1. - - Relevant `flags' are: - 0x10 enable console support for this unit. The other console flags - are ignored unless this is set. Currently, at most one unit can - have console support; the first one (in config file order) with - this flag set is preferred. This option alone will not make - the serial port the console. Set the following flag or use the -h - option described below, together with this flag. - 0x20 force this unit to be the console (unless there is another - higher priority console). This replaces the COMCONSOLE option. - - Example: - device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4 - - If the flags were not set, you need to run UserConfig (on a different - console) or recompile the kernel. - -- CREATE THE FILE "boot.config" IN THE ROOT DIRECTORY of the `a' partition - on the boot drive. Put the kernel name and options in one line. The - kernel name is optional. Options are subset of those described in boot(8): - -h toggle internal and serial consoles. You can use this to switch - console devices. For instance, if you boot from the VGA console, - you can use -h to force the kernel to use the serial port as its - console device. Alternatively, if you boot from the serial port, - you can use the -h to force the kernel to use the VGA display - as the console instead. (Can you say 'toggle' boys and girls? - I knew you could. :) - -D toggle single and dual console configurations. In the single - configuration the console will be either the VGA display (internal - console) or the serial port, depending on the state of the -h option - above. In the dual console configuration, both the VGA display - and the serial port will become the console at the same time, - regardless of the state of the -h option. - However, the dual console configuration takes effect only during - the boot prompt. Once the kernel is loaded, the console specified - by the -h option becomes the only console. - -P probe the keyboard. If no keyboard is found, the -D and -h options - are automatically set. - - Use either the -P option to select the console automatically, or the -h - option to force the serial console. - -- BOOT THE MACHINE. You'll see a prompt appear on the terminal that looks - something like this: - - No keyboard found - - >> FreeBSD BOOT @ 0x10000: 640/7168 k of memory, serial console - Boot default: 0:wd(0,a)kernel - - boot: - - This is identical to the prompt that normally appears on the VGA console, - except for the 'No keyboard found' message that indicates a keyboard - couldn't be detected, if the -P option is in `boot.config'. - - From here you can boot the system (or let it autoboot by itself) just - like you can from the VGA console and the kernel will automatically - use COM1 as the console device. This is done by passing a special flag - to the kernel in the 'boothowto' word. (The curious can refer to - <sys/reboot.h> and the sio driver sources for details.) - - -CAVEATS: - -- The idea here is to allow people to set up dedicated servers that require - no graphics hardware or attached keyboards. Unfortunately, while (most?) - every system will let you boot without a keyboard, there are quite a few - that will not let you boot without a graphics adapter. Machines with - AMI BIOSes can be configured to boot with no graphics adapter installed - simply by changing the 'graphics adapter' setting in the CMOS configuration - to 'Not installed.' However, many machines do not support this option - and will refuse to boot if you have no display hardware in the system. With - these machines, you'll have to leave some kind of graphics card plugged in, - (even if it's just a junky mono board) although you won't have to attach - a monitor into it. You might also try installing an AMI BIOS. :) - -- Using a port other than COM1 as the console requires some recompiling. - Again, it's usually assumed that COM1 will be available for use as a - console device on a dedicated file/compute/terminal server, so hopefully - you'll never need to do this. But if you feel you must change the console - to a different port, here's how: - - o Get the kernel source package. - o Edit /etc/make.conf and set BOOT_COMCONSOLE_PORT to the - address of the port you want to use (0x3F8, 0x2F8, 0x3E8 or - 0x2E8). Only COM1 through COM4 can be used; multiport serial - cards will not work. No interrupt setting is needed. - o Create a custom kernel configuration file and add appropriate - `flags' for the serial port you want to use. For example, if you - want to make COM2 the console: - - device sio1 at isa? port "IO_COM2" tty flags 0x10 irq 3 - - The console flags for the other serial ports should not be set. - o Recompile both the boot blocks and the kernel. - o Install the boot blocks with the disklabel command and boot - from the new kernel. - - -$FreeBSD$ diff --git a/sys/pc98/boot/biosboot/README.serial.98 b/sys/pc98/boot/biosboot/README.serial.98 deleted file mode 100644 index de98c827c095..000000000000 --- a/sys/pc98/boot/biosboot/README.serial.98 +++ /dev/null @@ -1,63 +0,0 @@ - README.srieal.98 - ¥·¥ê¥¢¥ë¥³¥ó¥½¡¼¥ë¤Ë¤Ä¤¤¤Æ - ²ÃÆ£¾æÅµ (kato@eclogite.eps.nagoya-u.ac.jp) - KATO Takenori - -FreeBSD(98)¤Î¥³¥ó¥½¡¼¥ë¤È¤·¤Æ¡¢Æâ¢RS-232C¥Ý¡¼¥È¤ËÀܳ¤µ¤ì¤¿¥À¥àüËö¤ò -»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢FreeBSD(98)¤ò¥µ¡¼¥Ð¤È¤·¤Æ»ÈÍѤ¹¤ë -»þ¤Ë¡¢¥¡¼¥Ü¡¼¥É¤ä¥â¥Ë¥¿¤òÀܳ¤·¤Ê¤¯¤Æ¤â¤«¤Þ¤ï¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£ - -¥·¥ê¥¢¥ë¥³¥ó¥½¡¼¥ë¤ò»ÈÍѤ¹¤ëºÝ¤Ï¡¢¤³¤Î¥É¥¥å¥á¥ó¥È¤ª¤è¤Ó¡¢IBM-PCÍѤΥ«¡¼ -¥Í¥ë¥½¡¼¥¹¤Ë´Þ¤Þ¤ì¤ë¡¢/usr/src/sys/i386/boot/biosboot/READEME.serial¤ò -Îɤ¯ÆÉ¤ó¤Ç²¼¤µ¤¤¡£ - -FreeBSD(98)¤Ç¥·¥ê¥¢¥ë¥³¥ó¥½¡¼¥ë¤ò»ÈÍѤ¹¤ëºÝ¤Ï¡¢°Ê²¼¤Î¼ê½ç¤ò¼Â¹Ô¤·¤Æ²¼ -¤µ¤¤¡£ - -1: ¥Ö¡¼¥È¥³¡¼¥É¤Î¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó - PC-9801¥·¥ê¡¼¥º¤Î¾ì¹ç¡¤¥¡¼¥Ü¡¼¥É¤¬Àܳ¤µ¤ì¤Æ¤¤¤Ê¤¤¾õÂ֤ȵ췿 - ¥¡¼¥Ü¡¼¥É¤¬Àܳ¤µ¤ì¤Æ¤¤¤ë¾õÂ֤Ȥò¶èÊ̤¹¤ëÊýË¡¤¬¤¢¤ê¤Þ¤»¤ó¡¥¤â - ¤·¡¤µì·¿¥¡¼¥Ü¡¼¥É¤ò»ÈÍѤ·¤Æ¤¤¤Æ - PROBE_KEYBOARD - ¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¡¤¥¡¼¥Ü¡¼¥É¤¬Ç§¼±¤µ¤ì¤º¤Ë¥·¥ê¥¢¥ë¥³¥ó¥½¡¼ - ¥ë¤¬»ÈÍѤµ¤ì¤Þ¤¹¡¥¤Þ¤¿¡¤ - FORCE_COMCONSOLE - ¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤È¡¤¥¡¼¥Ü¡¼¥É¤ÎÀܳ¾õÂ֤˴ؤï¤é¤º¥·¥ê¥¢¥ë¥³ - ¥ó¥½¡¼¥ë¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡¥ - -2: ¥¡¼¥Ü¡¼¥É¤òÀÚ¤êÎ¥¤¹ - ¥¡¼¥Ü¡¼¥É¤òÀܳ¤»¤º¤Ë¡¢ËÜÂΤòµ¯Æ°¤µ¤»¤¿¾ì¹ç¡¢¥·¥¹¥Æ¥àÎΰè¤Î¥¡¼ - ¥Ü¡¼¥É¥¿¥¤¥×¤¬¡¢µì¼°¥¡¼¥Ü¡¼¥É(CAPS¤¬µ¡³£¼°¤Î¥¡¼¥Ü¡¼¥É)¤ÈƱ¤¸ - ¤Ë¤Ê¤ê¤Þ¤¹¡£FreeBSD(98)¤Î¥Ö¡¼¥È¥³¡¼¥É¤Ï¡¢¤³¤ì¤ò¸¡½Ð¤·¤Æ¼«Æ°Åª - ¤Ë¥·¥ê¥¢¥ë¥³¥ó¥½¡¼¥ë¥â¡¼¥É¤Ë°Ü¤ê¤Þ¤¹¡£ - -3: üËö¤òÀܳ¤¹¤ë - Æâ¢RS-232C¥³¥Í¥¯¥¿¤Ë¥À¥àüËö¤òÀܳ¤·¤Æ²¼¤µ¤¤¡£¥À¥àüËö¤¬Ìµ¤¤ - ¾ì¹ç¤Ï¡¢Å¬Åö¤Ê¥Ñ¥½¥³¥ó¤ÇÄÌ¿®¥½¥Õ¥È¥¦¥§¥¢¤ò¼Â¹Ô¤µ¤»¤¿¤â¤Î¤ä¡¢ÄÌ - ¿®µ¡Ç½¤Ä¤¤Î¥ï¡¼¥×¥í¤Ê¤É¤ò»ÈÍѤ·¤Æ²¼¤µ¤¤¡£ - - FreeBSD(98)¤Î¥Ö¡¼¥È¥³¡¼¥É¤Ç¤Ï¡¢RS-232C¥Ý¡¼¥È¤ò9600¥Ü¡¼¡¢8¥Ó¥Ã - ¥È¡¢¥Ñ¥ê¥Æ¥£Ìµ¤·¤ËÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£ - -4: ËÜÂΤòµ¯Æ°¤¹¤ë - ¥Ö¡¼¥È¥Ö¥í¥Ã¥¯¤Ï¡¢µ¯Æ°»þ¤Ë¥¡¼¥Ü¡¼¥É¤ÎÀܳ¤ò¸¡ºº¤·¤Þ¤¹¡£¤â¤·¡¢ - ¥¡¼¥Ü¡¼¥É¤¬Àܳ¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢Ã¼Ëö¤Ë°Ê²¼¤Î¥á¥Ã¥»¡¼¥¸¤¬É½¼¨ - ¤µ¤ì¤Þ¤¹¡£ - - No keyboard found. - - >> FreeBSD BOOT @0x90000 640/25600 k of memory - Use hd(1,a)/kernel to boot sd0 when wd0 is also installed. - Usage: [[[fd(0,a)]/kernel][-Dabcdhrsv]] - Use ? for file list or press Enter for defaults - - Boot: - - ¤³¤ì¤Ï¡¢ÉáÃʸ«¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¤È¤Û¤È¤ó¤ÉÊѤï¤ê¤Þ¤»¤ó¤¬¡¢¤Ï¤¸¤á - ¤Ë¡¢`No keyboard found'¤Èɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤³¤Ç¡¢¥À¥àüËö¤« - ¤é¡¢¥³¥ó¥½¡¼¥ë¾å¤Çµ¯Æ°¤·¤Æ¤¤¤ë»þ¤ÈƱ¤¸¤è¤¦¤Ë¥«¡¼¥Í¥ë¤òΩ¤Á¾å¤² - ¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£µ¯Æ°¸å¤Î¥á¥Ã¥»¡¼¥¸¤Ï¥À¥àüËö¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£ - - ¤â¤·¡¢¥·¥ê¥¢¥ë¥³¥ó¥½¡¼¥ë¤«¤éÄ̾ï¤Î¥³¥ó¥½¡¼¥ë¤ËÀÚÂØ¤¨¤ë¤Ë¤Ï¡¢ - `-h'¥ª¥×¥·¥ç¥ó¤ò¤Ä¤±¤Æµ¯Æ°¤·¤Æ²¼¤µ¤¤¡£ - diff --git a/sys/pc98/boot/biosboot/asm.S b/sys/pc98/boot/biosboot/asm.S deleted file mode 100644 index f14c7f55104c..000000000000 --- a/sys/pc98/boot/biosboot/asm.S +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd - * $FreeBSD$ - */ - - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - - .file "asm.s" - -#include "asm.h" - - -CR0_PE_ON = 0x1 -CR0_PE_OFF = 0xfffffffe - - .text - -/* - * - * real_to_prot() - * transfer from real mode to protected mode. - */ - -ENTRY(real_to_prot) - /* guarantee that interrupt is disabled when in prot mode */ - cli - - /* load the gdtr */ - addr32 - data32 - lgdt EXT(Gdtr) - - /* set the PE bit of CR0 */ - mov %cr0, %eax - - data32 - or $CR0_PE_ON, %eax - mov %eax, %cr0 - - /* - * make intrasegment jump to flush the processor pipeline and - * reload CS register - */ - data32 - ljmp $0x18, $xprot -xprot: - - /* - * we are in USE32 mode now - * set up the protected mode segment registers : DS, SS, ES, FS - */ - movw $0x20, %ax /* data segment */ - mov %ax, %ds /* gas would waste a prefix byte for movw */ - mov %ax, %ss - mov %ax, %es - movw $0x10, %ax /* flat segment */ - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - lidt EXT(Idtr_prot) -#endif - - ret - -/* - * - * prot_to_real() - * transfer from protected mode to real mode - * - */ - -ENTRY(prot_to_real) - - /* Prepare %ax while we're still in a mode that gas understands. */ - movw $0x30, %ax - - /* Change to use16 mode. */ - ljmp $0x28, $x16 -x16: - - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - - /* clear the PE bit of CR0 */ - mov %cr0, %eax - data32 - and $CR0_PE_OFF, %eax - mov %eax, %cr0 - - /* - * make intersegment jmp to flush the processor pipeline - * and reload CS register - */ - data32 - ljmp $BOOTSEG, $xreal -xreal: - - /* - * we are in real mode now - * set up the real mode segment registers : DS, SS, ES, FS - */ - mov %cs, %ax - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - -#ifdef BDE_DEBUGGER - /* load idtr so we can debug */ - addr32 - data32 - lidt EXT(Idtr_real) -#endif - - data32 - ret - -/* - * startprog(phyaddr) - * start the program on protected mode where phyaddr is the entry point - * - * XXX This whole mess should go away and we should run the boot code in - * flat 32 bit mode with it linked -T BOOTSEG. See the netboot code for - * how this is done. - */ - -ENTRY(startprog) - push %ebp - mov %esp, %ebp - movl %esp, %eax /* Use eax as the old stack pointer */ - - /* convert the current stack to a 32 bit flat model */ - movw $0x10, %bx - mov %bx, %ss - addl $(BOOTSEG<<4),%esp - - /* copy the arguments from the old stack to the new stack */ - pushl 0x14(%eax) /* &bootinfo */ - pushl $0 /* was &nfsdiskless */ - pushl $0 /* was esym */ - pushl $0 /* was cyloffset */ - pushl 0x10(%eax) /* bootdev */ - pushl 0x0C(%eax) /* howto */ - movl $(ourreturn),%ebx - addl $(BOOTSEG<<4),%ebx /* Fix it up for flat segments */ - pushl %ebx /* our return address */ - - /* push on our entry address */ - pushl $0x08 /* segment selector */ - pushl 0x08(%eax) /* kernel entry address */ - - /* convert over the other data segs */ - movw $0x10, %bx - mov %bx, %ds - mov %bx, %es - - /* convert the PC (and code seg) */ - lret -ourreturn: - /* For now there is not much we can do, just lock in a loop */ - jmp ourreturn - -/* - * pcpy(src, dst, cnt) - * where src is a virtual address and dst is a physical address - */ - -ENTRY(pcpy) - push %ebp - mov %esp, %ebp - push %es - push %esi - push %edi - push %ecx - - cld - - /* set %es to point at the flat segment */ - movw $0x10, %ax - mov %ax, %es - - mov 0x8(%ebp), %esi /* source */ - mov 0xc(%ebp), %edi /* destination */ - mov 0x10(%ebp), %ecx /* count */ - - rep - movsb - - pop %ecx - pop %edi - pop %esi - pop %es - pop %ebp - - ret diff --git a/sys/pc98/boot/biosboot/asm.h b/sys/pc98/boot/biosboot/asm.h deleted file mode 100644 index 6f4bcc39e52d..000000000000 --- a/sys/pc98/boot/biosboot/asm.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1991,1990,1989 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.7 92/02/29 15:33:41 rpd - * $FreeBSD$ - */ - -#define S_ARG0 4(%esp) -#define S_ARG1 8(%esp) -#define S_ARG2 12(%esp) -#define S_ARG3 16(%esp) - -#define FRAME pushl %ebp; movl %esp, %ebp -#define EMARF leave - -#define B_ARG0 8(%ebp) -#define B_ARG1 12(%ebp) -#define B_ARG2 16(%ebp) -#define B_ARG3 20(%ebp) - -#ifdef wheeze - -#define ALIGN 4 -#define EXT(x) x -#define LEXT(x) x: -#define LCL(x) ./**/x - -#define LB(x,n) ./**/x -#define LBb(x,n) ./**/x -#define LBf(x,n) ./**/x - -#define SVC lcall $7,$0 - -#define String .string -#define Value .value -#define Times(a,b) [a\*b] -#define Divide(a,b) [a\\b] - -#define INB inb (%dx) -#define OUTB outb (%dx) -#define INL inl (%dx) -#define OUTL outl (%dx) - -#else wheeze -#define ALIGN -#define LCL(x) x - -#define LB(x,n) n -#ifdef __STDC__ -#define EXT(x) _ ## x -#define LEXT(x) _ ## x ## : - -#define LBb(x,n) n ## b -#define LBf(x,n) n ## f -#else __STDC__ -#define EXT(x) _/**/x -#define LEXT(x) _/**/x/**/: -#define LBb(x,n) n/**/b -#define LBf(x,n) n/**/f -#endif __STDC__ -#define SVC .byte 0x9a; .long 0; .word 0x7 - -#define String .ascii -#define Value .word -#define Times(a,b) (a*b) -#define Divide(a,b) (a/b) - -#define INB inb %dx, %al -#define OUTB outb %al, %dx -#define INL inl %dx, %eax -#define OUTL outl %eax, %dx - -#endif wheeze - -#define addr32 .byte 0x67 -#define data32 .byte 0x66 - -#ifdef GPROF -#ifdef __STDC__ - -#define MCOUNT .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ASENTRY(x) .globl x; .align ALIGN; x ## : ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; - -#else __STDC__ - -#define MCOUNT .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x: ; \ - pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp; - -#endif __STDC__ -#else GPROF -#ifdef __STDC__ - -#define MCOUNT -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x ## : - -#else __STDC__ - -#define MCOUNT -#define ENTRY(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \ - .align ALIGN; LEXT(x) LEXT(y) -#define ASENTRY(x) .globl x; .align ALIGN; x: - -#endif __STDC__ -#endif GPROF - -#define Entry(x) .globl EXT(x); .align ALIGN; LEXT(x) -#define DATA(x) .globl EXT(x); .align ALIGN; LEXT(x) diff --git a/sys/pc98/boot/biosboot/bios.S b/sys/pc98/boot/biosboot/bios.S deleted file mode 100644 index 88d9506c46b4..000000000000 --- a/sys/pc98/boot/biosboot/bios.S +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $FreeBSD$ - */ - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -/* - * Ported to PC-9801 by Yoshio Kimura - */ - -/* - * Extensions for El Torito CD-ROM booting: - * - * Copyright © 1997 Pluto Technologies International, Inc. Boulder CO - * Copyright © 1997 interface business GmbH, Dresden. - * All rights reserved. - * - * This code has been written by Jörg Wunsch, Dresden. - * Direct comments to <joerg_wunsch@interface-business.de>. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - - .file "bios.s" - -#include "asm.h" - .text - -#ifndef CDBOOT - -/* - * biosread(dev, cyl, head, sec, nsec, offset) - * Read "nsec" sectors from disk to offset "offset" in boot segment - * BIOS call "INT 0x1B Function 0xn6" to read sectors from disk into memory - * Call with %ah = 0xd6(for floppy disk) or 0x06(for hard disk) - * %al = DA/UA - * %bx = data length - * %ch = sector size(for floppy) or cylinder(for hard) - * %cl = cylinder - * %dh = head - * %dl = sector - * %es:%bp = segment:offset of buffer - * Return: - * %al = 0x0 on success; err code on failure - */ - -ENTRY(biosread) - push %ebp - mov %esp, %ebp - - push %ebx - push %esi - push %edi - - movb 0x14(%ebp), %dl /* sector */ - movb 0x10(%ebp), %dh /* head */ - movw 0x0c(%ebp), %cx /* cylinder */ - movb 0x08(%ebp), %al /* DA/UA */ - movb $0x06, %ah - andb $0xf0, %al - cmpb $0x30, %al - jz fd - cmpb $0x90, %al - jnz 1f -fd: - incb %dl - movb $0x02, %ch - movb $0xd6, %ah -1: - movb 0x08(%ebp), %al - movl %eax, %ebx - - /* prot_to_real will set %es to BOOTSEG */ - call EXT(prot_to_real) /* enter real mode */ - mov %ebx, %eax - xor %ebx, %ebx - addr32 - movb 0x18(%ebp), %bl /* number of sectors */ - data32 - shl $9, %ebx - data32 - push %ebx - addr32 - data32 - mov 0x1c(%ebp), %ebx - data32 - mov %ebx, %ebp - data32 - pop %ebx - - int $0x1b - jc 1f - xor %eax, %eax -1: - /* 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 %edi - pop %esi - pop %ebx - pop %ebp - - 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 - * Call with %ah = 0x0 - * Return: %ah = keyboard scan code - * %al = ASCII character - */ - -ENTRY(getc) - push %ebp - mov %esp, %ebp - push %ebx /* save %ebx */ - push %esi - push %edi - - call EXT(prot_to_real) - - movb $0x0, %ah - int $0x18 - - movb %al, %bl /* real_to_prot uses %eax */ - - data32 - call EXT(real_to_prot) - - xor %eax, %eax - movb %bl, %al - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret -/* - * ischar() - * if there is a character pending, return it; otherwise return 0 - * BIOS call "INT 18H Function 01H" to check whether a character is pending - * Call with %ah = 0x1 - * Return: - * If key waiting to be input: - * %ah = keyboard scan code - * %al = ASCII character - * %bh = 1 - * else - * %bh = 0 - */ -ENTRY(ischar) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - call EXT(prot_to_real) /* enter real mode */ - - xor %ebx, %ebx - movb $0x1, %ah - int $0x18 - andb %bh, %bh - data32 - jz nochar - movb %al, %bl - -nochar: - data32 - call EXT(real_to_prot) - - xor %eax, %eax - movb %bl, %al - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/* - * - * get_diskinfo(): return a word that represents the - * max number of sectors and heads and drives for this device - * - */ - -ENTRY(get_diskinfo) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - movb 0x8(%ebp), %dl /* diskinfo(drive #) */ - call EXT(prot_to_real) /* enter real mode */ - - movb %dl, %al /* ask for disk info */ - andb $0xf0, %al - cmpb $0x30, %al - jz fdd4 - cmpb $0x90, %al - jz fdd - - movb %dl, %al - movb $0x84, %ah - - int $0x1b - - jnc ok - /* - * Urk. Call failed. It is not supported for floppies by old BIOS's. - * Guess it's a 15-sector floppy. - */ -fdd4: - movb $18, %dl - jmp 1f -fdd: - movb $15, %dl /* max sector */ -1: - subb %ah, %ah /* %ax = 0 */ - movb %al, %al - movb %ah, %bh /* %bh = 0 */ - movb $2, %bl /* %bl bits 0-3 = drive type, - bit 2 = 1.2M */ - movb $79, %ch /* max track */ - movb $1, %cl /* # floppy drives installed */ - movb $2, %dh /* max head */ - /* es:di = parameter table */ - /* carry = 0 */ -ok: - - data32 - call EXT(real_to_prot) /* back to protected mode */ - - /* - * form a longword representing all this gunk: - * 16 bit cylinder - * 8 bit head - * 8 bit sector - */ - mov %ecx, %eax - sall $16,%eax /* << 16 */ - movb %dh, %ah /* max head */ - movb %dl, %al /* max sector (and # sectors) */ - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/* - * - * memsize(i) : return the memory size in KB. i == 0 for conventional memory, - * i == 1 for extended memory - * Both have the return value in AX. - * - */ - -ENTRY(memsize) - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - mov 8(%ebp), %ebx - - xor %eax, %eax - cmpb $0x01, %bl - jnz memcnv -memext: - movb 0xA1401 - BOOTSEG * 0x10, %al - shll $7, %eax - xorl %ebx, %ebx - movw 0xA1594 - BOOTSEG * 0x10, %bx - shll $10, %ebx - addl %ebx, %eax - jmp xdone - -memcnv: - movb 0xA1501 - BOOTSEG * 0x10, %al - andb $0x07, %al - incl %eax - shll $7, %eax - -xdone: - pop %edi - pop %esi - pop %ebx - pop %ebp - ret diff --git a/sys/pc98/boot/biosboot/boot.c b/sys/pc98/boot/biosboot/boot.c deleted file mode 100644 index faa4c37040bb..000000000000 --- a/sys/pc98/boot/biosboot/boot.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, [92/04/03 16:51:14 rvb] - * $FreeBSD$ - */ - - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include <sys/param.h> -#include "boot.h" -#include <a.out.h> -#include <sys/reboot.h> -#include <machine/bootinfo.h> - -#define ouraddr (BOOTSEG << 4) /* XXX */ - -#define BOOT_CONFIG_SIZE 512 -#define BOOT_HELP_SIZE 2048 -#define KERNEL_CONFIG_SIZE 512 -#define NAMEBUF_LEN 1024 /* oversized to defend against gets() */ - -static char boot_config[BOOT_CONFIG_SIZE]; -static char boot_help[BOOT_HELP_SIZE]; -#ifdef NAMEBLOCK -char *dflt_name; -#endif -char *name; -static char kernel_config[KERNEL_CONFIG_SIZE]; -static char kernel_config_namebuf[NAMEBUF_LEN + sizeof "config"]; -static char linebuf[NAMEBUF_LEN]; -static char namebuf[NAMEBUF_LEN]; -static struct bootinfo bootinfo; -int loadflags; - -static void getbootdev(char *ptr, int *howto); -static void loadprog(void); -static void readfile(char *path, char *buf, size_t nbytes); - -/* NORETURN */ -void -boot(int drive) -{ - int ret; -#ifdef PC98 - int i; - unsigned char disk_equips; -#endif - - /* Pick up the story from the Bios on geometry of disks */ - -#ifdef PC98 - for(ret = 0; ret < 2; ret ++) { - if (*(unsigned char*)V(0xA155d) & (1 << ret)) { - bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80); - } -#else /* IBM-PC */ - for(ret = 0; ret < N_BIOS_GEOM; ret ++) - bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80); -#endif /* PC98 */ - } - - bootinfo.bi_basemem = memsize(0); - bootinfo.bi_extmem = memsize(1); - bootinfo.bi_memsizes_valid = 1; - - gateA20(); - -#ifdef PC98 - /* set machine type to PC98_SYSTEM_PARAMETER */ - machine_check(); -#endif /* PC98 */ - - /* - * The default boot device is the first partition in the - * compatibility slice on the boot drive. - */ - dosdev = drive; -#ifdef PC98 - maj = (drive&0x70) >> 3; /* a good first bet */ - if (maj == 4) { /* sd */ - disk_equips = *(unsigned char *)V(0xA1482); - unit = 0; - for (i=0; i<(drive&0x0f); i++) { - unit += (disk_equips >> i) & 1; - } - } else { - unit = drive & 0x0f; - } -#else /* IBM-PC */ - maj = 2; - unit = drive & 0x7f; -#ifdef dontneed - slice = 0; - part = 0; -#endif - if (drive & 0x80) { - /* Hard drive. Adjust. */ - maj = 0; -#if BOOT_HD_BIAS > 0 - if (unit >= BOOT_HD_BIAS) { - /* - * The drive is probably a SCSI drive with a unit - * number BOOT_HD_BIAS less than the BIOS drive - * number. - */ - maj = 4; - unit -= BOOT_HD_BIAS; - } -#endif - } -#endif /* PC98 */ -#ifndef RAWBOOT - readfile("boot.config", boot_config, BOOT_CONFIG_SIZE); - readfile("boot.help", boot_help, BOOT_HELP_SIZE); -#endif -#ifdef NAMEBLOCK - /* - * XXX - * DAMN! I don't understand why this is not being set - * by the code in boot2.S - */ - dflt_name= (char *)0x0000ffb0; - if( (*dflt_name++ == 'D') && (*dflt_name++ == 'N')) { - name = dflt_name; - } else -#endif /*NAMEBLOCK*/ - name = "kernel"; - if (boot_config[0] != '\0') { - printf("boot.config: %s", boot_config); - getbootdev(boot_config, &loadflags); - if (openrd() != 0) - name = "kernel"; - } -loadstart: - /* print this all each time.. (saves space to do so) */ - /* If we have looped, use the previous entries as defaults */ - printf("\r \n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory, %s%s console\n" - "Boot default: %d:%s(%d,%c)%s\n" - "%s\n" - "boot: ", - ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem, - (loadflags & RB_SERIAL) ? "serial" : "internal", - (loadflags & RB_DUAL) ? "/dual" : "", -#ifdef PC98 - dosdev & 0x0f, devs[maj], unit, 'a' + part, -#else - dosdev & 0x7f, devs[maj], unit, 'a' + part, -#endif - name ? name : "*specify_a_kernel_name*", - boot_help); - - /* - * Ignore flags from previous attempted boot, if any. - * XXX this is now too strict. Settings given in boot.config should - * not be changed. - */ - loadflags &= (RB_DUAL | RB_SERIAL); - - /* - * Be paranoid and make doubly sure that the input buffer is empty. - */ - if (loadflags & (RB_DUAL | RB_SERIAL)) - init_serial(); - - if (!gets(linebuf)) - putchar('\n'); - else - getbootdev(linebuf, &loadflags); - if (name == NULL) - goto loadstart; - ret = openrd(); - if (ret != 0) { - if (ret > 0) - printf("Can't find %s\n", name); - goto loadstart; - } -/* if (inode.i_mode&IEXEC) - loadflags |= RB_KDB; -*/ - loadprog(); - goto loadstart; -} - -static void -loadprog(void) -{ - struct exec head; - int startaddr; - int addr; /* physical address.. not directly useable */ - int bootdev; - int i; - unsigned pad; - char *s, *t; - - read((void *)&head, sizeof(head)); - if ( N_BADMAG(head)) { - printf("Invalid format!\n"); - return; - } - - poff = N_TXTOFF(head); - /*if(poff==0) - poff = 32;*/ - - /* - * We assume that the entry address is the same as the lowest text - * address and that the kernel startup code handles relocation by - * this address rounded down to a multiple of 16M. - */ - startaddr = head.a_entry & 0x00FFFFFF; - addr = startaddr; - printf("Booting %d:%s(%d,%c)%s @ 0x%x\n" -#ifdef PC98 - , dosdev & 0x0f -#else - , dosdev & 0x7f -#endif - , devs[maj] - , unit - , 'a'+part - , name - , addr); - if(addr < 0x00100000) - { - /* - * Bail out, instead of risking to damage the BIOS - * variables, the loader, or the adapter memory area. - * We don't support loading below 1 MB any more. - */ - printf("Start address too low\n"); - return; - } - printf("text=0x%x ", head.a_text); - /********************************************************/ - /* LOAD THE TEXT SEGMENT */ - /********************************************************/ - xread((void *)addr, head.a_text); - addr += head.a_text; - - /********************************************************/ - /* Load the Initialised data after the text */ - /********************************************************/ - while (addr & PAGE_MASK) - *(char *)addr++ = 0; - - printf("data=0x%x ", head.a_data); - xread((void *)addr, head.a_data); - addr += head.a_data; - - /********************************************************/ - /* Skip over the uninitialised data */ - /* (but clear it) */ - /********************************************************/ - printf("bss=0x%x ", head.a_bss); - -/* - * XXX however, we should be checking that we don't load ... into - * nonexistent memory. A full symbol table is unlikely to fit on 4MB - * machines. - */ - /* kzip & kernel will zero their own bss */ - addr += head.a_bss; - - /* Pad to a page boundary. */ - pad = (unsigned)addr & PAGE_MASK; - if (pad != 0) { - pad = PAGE_SIZE - pad; - addr += pad; - } - bootinfo.bi_symtab = addr; - - /********************************************************/ - /* Copy the symbol table size */ - /********************************************************/ - pcpy(&head.a_syms, (void *)addr, sizeof(head.a_syms)); - addr += sizeof(head.a_syms); - - /********************************************************/ - /* Load the symbol table */ - /********************************************************/ - printf("symbols=[+0x%x+0x%x+0x%x", pad, sizeof(head.a_syms), - head.a_syms); - xread((void *)addr, head.a_syms); - addr += head.a_syms; - - /********************************************************/ - /* Load the string table size */ - /********************************************************/ - read((void *)&i, sizeof(int)); - pcpy(&i, (void *)addr, sizeof(int)); - i -= sizeof(int); - addr += sizeof(int); - - /********************************************************/ - /* Load the string table */ - /********************************************************/ - printf("+0x%x+0x%x]\n", sizeof(int), i); - xread((void *)addr, i); - addr += i; - - bootinfo.bi_esymtab = addr; - - /* - * For backwards compatibility, use the previously-unused adaptor - * and controller bitfields to hold the slice number. - */ - bootdev = MAKEBOOTDEV(maj, (slice >> 4), slice & 0xf, unit, part); - - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_kernelname = (u_int32_t)(name + ouraddr); - bootinfo.bi_nfs_diskless = 0; - bootinfo.bi_size = sizeof(bootinfo); - bootinfo.bi_bios_dev = dosdev; - - /* - * Load the kernel config file (if any). Its name is given by - * appending ".config" to the kernel name. Build the name inline - * because no str*() functions are available. The file has to be - * copied to &disklabel for userconfig. It can't be loaded there - * directly because the label is used late in readfile() in some - * unusual cases. - */ - s = name; - t = kernel_config_namebuf; - do - ; - while ((*t++ = *s++) != '\0'); - s = ".config"; - --t; - do - ; - while ((*t++ = *s++) != '\0'); - readfile(kernel_config_namebuf, kernel_config, KERNEL_CONFIG_SIZE); - pcpy(kernel_config, (char *)&disklabel + ouraddr, KERNEL_CONFIG_SIZE); - - printf("total=0x%x entry point=0x%x\n", addr, startaddr); - startprog(startaddr, loadflags | RB_BOOTINFO, bootdev, - (unsigned)&bootinfo + ouraddr); -} - -static void -readfile(char *path, char *buf, size_t nbytes) -{ - int openstatus; - - buf[0] = '\0'; - name = path; - openstatus = openrd(); - if (openstatus != 0) { - if (openstatus > 0) - printf("Can't find file %s\n", name); - } else { - /* XXX no way to determine file size. */ - read(buf, nbytes); - } - buf[nbytes - 1] = '\0'; -} - -static void -getbootdev(char *ptr, int *howto) -{ - char c; - int f; - char *p; - - /* Copy the flags to save some bytes. */ - f = *howto; - - c = *ptr; - for (;;) { -nextarg: - while (c == ' ' || c == '\n') - c = *++ptr; - if (c == '-') - while ((c = *++ptr) != '\0') { - if (c == ' ' || c == '\n') - goto nextarg; - if (c == 'a') - f |= RB_ASKNAME; - if (c == 'C') - f |= RB_CDROM; - if (c == 'c') - f |= RB_CONFIG; - if (c == 'D') - f ^= RB_DUAL; - if (c == 'd') - f |= RB_KDB; - if (c == 'g') - f |= RB_GDB; - if (c == 'h') - f ^= RB_SERIAL; - if (c == 'P') - f |= RB_PROBEKBD; - if (c == 'r') - f |= RB_DFLTROOT; - if (c == 's') - f |= RB_SINGLE; - if (c == 'v') - f |= RB_VERBOSE; - } - if (c == '\0') - break; - p = name = namebuf; - while (c != '\0' && c != ' ' && c != '\n') { - *p++ = c; - c = *++ptr; - } - *p = '\0'; - } - if (f & RB_PROBEKBD) { - if (probe_keyboard()) { - f |= RB_DUAL | RB_SERIAL; - printf("No keyboard found\n"); - } else - printf("Keyboard found\n"); - } - if (f & (RB_DUAL | RB_SERIAL)) - init_serial(); - *howto = f; -} diff --git a/sys/pc98/boot/biosboot/boot.h b/sys/pc98/boot/biosboot/boot.h deleted file mode 100644 index 4e32192eebc6..000000000000 --- a/sys/pc98/boot/biosboot/boot.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:03 rpd - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/time.h> - -#include <ufs/ffs/fs.h> -#include <ufs/ufs/quota.h> -#include <ufs/ufs/inode.h> - -#define RB_DUAL 0x40000 /* XXX */ -#define RB_PROBEKBD 0x80000 /* XXX */ - -extern char *devs[]; -extern char *name; -extern struct fs *fs; -extern struct inode inode; -extern int dosdev, unit, slice, part, maj, boff, poff; -extern unsigned tw_chars; -extern int loadflags; -extern struct disklabel disklabel; - -/* asm.S */ -#if ASM_ONLY -void real_to_prot(void); -void prot_to_real(void); -#endif -void startprog(unsigned int physaddr, int howto, int bootdev, - /* XXX struct bootinfo * */ unsigned int bootinfo); -void pcpy(const void *src, void *dst, size_t count); - -/* bios.S */ -int biosread(int dev, int cyl, int head, int sec, int nsec, void *offset); -void putc(int c); -int getc(void); -int ischar(void); -int get_diskinfo(int drive); -int memsize(int extended); - -/* boot.c */ -void boot(int drive); - -/* boot2.S */ -void boot2(void); - -/* disk.c */ -int devopen(void); -void devread(char *iodest, int sector, int cnt); - -/* io.c */ -void gateA20(void); -void printf(const char *format, ...); -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 bcopy(const void *from, void *to, size_t len); -void twiddle(void); -#ifdef PC98 -void machine_check(void); -#endif - -/* probe_keyboard.c */ -int probe_keyboard(void); - -/* serial.S */ -void serial_putc(int ch); -int serial_getc(void); -int serial_ischar(void); -void init_serial(void); - -/* sys.c */ -void xread(char *addr, int size); -void read(char *buffer, int count); -int openrd(void); - -#ifdef PC98 -#define V(ra) (ra - BOOTSEG * 0x10) -#endif - diff --git a/sys/pc98/boot/biosboot/boot2.S b/sys/pc98/boot/biosboot/boot2.S deleted file mode 100644 index 47b9a0643f45..000000000000 --- a/sys/pc98/boot/biosboot/boot2.S +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:26 rpd - * boot2.S,v 1.6 1995/01/25 21:37:40 bde Exp - */ -/* - * Ported to PC-9801 by Yoshio Kimura - */ - -#include "asm.h" - -/* Conventional GDT indexes. */ -#define BOOT_CS_INDEX 3 -#define BOOT_CS16_INDEX 5 -#define BOOT_DS_INDEX 4 - -#ifdef BDE_DEBUGGER -#define DB_CS_INDEX 14 -#define DB_CS16_INDEX 15 -#define DB_DS_INDEX 16 -#define GDT_INDEX 17 -#endif - -/* Vector numbers. */ -#define BREAKPOINT_VECTOR 3 -#define DEBUG_VECTOR 1 - -/* - * boot2() -- second stage boot - * SP points to default string if found - */ - -ENTRY(boot2) - data32 - subl %eax, %eax - mov %cs, %ax - mov %ax, %ds - mov %ax, %es - data32 - shll $4, %eax - - /* fix up GDT entries for bootstrap */ -#define FIXUP(gdt_index) \ - addr32; \ - movl %eax, EXT(Gdt)+(8*gdt_index)+2; /* actually movw %ax */ \ - addr32; \ - movb %bl, EXT(Gdt)+(8*gdt_index)+4 - - data32 - shld $16, %eax, %ebx - FIXUP(BOOT_CS_INDEX) - FIXUP(BOOT_CS16_INDEX) - FIXUP(BOOT_DS_INDEX) - - /* fix up GDT pointer */ - data32 - movl %eax, %ecx - data32 - addl $ EXT(Gdt), %eax - addr32 - data32 - movl %eax, EXT(Gdtr)+2 - -#ifdef BDE_DEBUGGER - /* fix up GDT entry for GDT */ - data32 - shld $16, %eax, %ebx - FIXUP(GDT_INDEX) - - /* fix up IDT pointer */ - data32 - addl $ EXT(Idt), %ecx - addr32 - data32 - movl %ecx, EXT(Idtr_prot)+2 - - /* %es = vector table segment for a while */ - push %es - data32 - subl %eax, %eax - mov %ax, %es - - /* fix up GDT entries for bdb */ - data32 - movl $4*DEBUG_VECTOR, %esi - addr32 - movl %es: 2(%esi), %eax /* actually movw to %ax */ - data32 - shll $4, %eax - data32 - shld $16, %eax, %ebx - FIXUP(DB_CS_INDEX) - FIXUP(DB_CS16_INDEX) - FIXUP(DB_DS_INDEX) - - /* Fetch entry points of bdb's protected mode trap handlers. These - * are stored at 2 before the corresponding entry points for real mode. - */ - data32 - subl %ebx, %ebx - addr32 - movl %es: (%esi), %ebx /* actually movw to %bx */ - data32 - subl %ecx, %ecx - addr32 - movl %es: 4*(BREAKPOINT_VECTOR-DEBUG_VECTOR)(%esi), %ecx - /* actually movw to %cx */ - - /* %es = bdb segment for a while */ - data32 - shrl $4, %eax - mov %ax, %es - - /* fix up IDT entries for bdb */ - data32 - subl $2, %ebx /* calculate EA to check it */ - jb 1f /* give up if it would trap */ - addr32 - movl %es: (%ebx), %eax /* actually movw to %ax */ - addr32 - movl %eax, EXT(Idt)+8*DEBUG_VECTOR /* actually movw %ax */ -1: - data32 - subl $2, %ecx - jb 1f - addr32 - movl %es: (%ecx), %eax /* actually movw to %ax */ - addr32 - movl %eax, EXT(Idt)+8*BREAKPOINT_VECTOR /* actually movw %ax */ -1: - - /* finished with groping in real mode segments */ - pop %es -#endif /* BDE_DEBUGGER */ - - /* change to protected mode */ - data32 - call EXT(real_to_prot) - - /* clear the bss */ - movl $ EXT(edata), %edi /* no EXT(_edata) - krufty ld */ - movl $ EXT(end), %ecx /* or EXT(_end) */ - subl %edi, %ecx - subb %al, %al - rep - stosb - -#ifdef NAMEBLOCK - movl %esp, EXT(dflt_name) -#endif - -#ifdef PC98 - movb 0xA1584 - BOOTSEG * 0x10, %dl -#endif - movzbl %dl, %edx /* discard head (%dh) and random high bits */ - pushl %edx - call EXT(boot) -oops: - hlt - jmp oops diff --git a/sys/pc98/boot/biosboot/disk.c b/sys/pc98/boot/biosboot/disk.c deleted file mode 100644 index 5f9033fc801d..000000000000 --- a/sys/pc98/boot/biosboot/disk.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:49 rpd - * $FreeBSD$ - */ - -/* - * Ported to PC-9801 by Yoshio Kimura - */ - -/* - * 93/10/08 bde - * If there is no 386BSD partition, initialize the label sector with - * LABELSECTOR instead of with garbage. - * - * 93/08/22 bde - * Fixed reading of bad sector table. It is at the end of the 'c' - * partition, which is not always at the end of the disk. - */ - -#include "boot.h" -#include <sys/disklabel.h> -#include <sys/diskslice.h> - -#define BIOS_DEV_FLOPPY 0x0 -#define BIOS_DEV_WIN 0x80 - -#define BPS 512 -#define SPT(di) ((di)&0xff) -#define HEADS(di) (((di)>>8)&0xff) - -static int bsize; - -static int spt, spc; - -struct fs *fs; -struct inode inode; -int dosdev, unit, slice, part, maj, boff; - -/*#define EMBEDDED_DISKLABEL 1*/ - -/* Read ahead buffer large enough for one track on a 1440K floppy. For - * reading from floppies, the bootstrap has to be loaded on a 64K boundary - * to ensure that this buffer doesn't cross a 64K DMA boundary. - */ -#define RA_SECTORS 18 -static char ra_buf[RA_SECTORS * BPS]; -static int ra_dev; -static int ra_end; -static int ra_first; - -static char *Bread(int dosdev, int sector); - -int -devopen(void) -{ - struct dos_partition *dptr; - struct disklabel *dl; - char *p; - int i, sector = 0, di, dosdev_copy; - - dosdev_copy = dosdev; - di = get_diskinfo(dosdev_copy); - spc = (spt = SPT(di)) * HEADS(di); - -#ifndef RAWBOOT - if ((dosdev_copy & 0xf0) == 0x90) - { - boff = 0; - part = (spt == 15 ? 0 : 1); - } - else - { -#ifdef EMBEDDED_DISKLABEL - dl = &disklabel; -#else EMBEDDED_DISKLABEL -#ifdef PC98 - p = Bread(dosdev_copy, 1); - dptr = (struct dos_partition *)p; - slice = WHOLE_DISK_SLICE; - for (i = 0; i < NDOSPART; i++, dptr++) - if (dptr->dp_mid == DOSPTYP_386BSD) { - slice = BASE_SLICE + i; - sector = dptr->dp_scyl * spc; - break; - } - p = Bread(dosdev, sector + LABELSECTOR); - dl=((struct disklabel *)p); - disklabel = *dl; /* structure copy (maybe useful later)*/ -#else - p = Bread(dosdev_copy, 0); - dptr = (struct dos_partition *)(p+DOSPARTOFF); - slice = WHOLE_DISK_SLICE; - for (i = 0; i < NDOSPART; i++, dptr++) - if (dptr->dp_typ == DOSPTYP_386BSD) { - slice = BASE_SLICE + i; - sector = dptr->dp_start; - break; - } - p = Bread(dosdev_copy, sector + LABELSECTOR); - dl=((struct disklabel *)p); - disklabel = *dl; /* structure copy (maybe useful later)*/ -#endif /* PC98 */ -#endif EMBEDDED_DISKLABEL - if (dl->d_magic != DISKMAGIC) { - printf("bad disklabel\n"); - return 1; - } - if( (maj == 4) || (maj == 0) || (maj == 1)) - { - if (dl->d_type == DTYPE_SCSI) - { - maj = 4; /* use scsi as boot dev */ - } - else - { - maj = 0; /* must be ESDI/IDE */ - } - } - /* This little trick is for OnTrack DiskManager disks */ - boff = dl->d_partitions[part].p_offset - - dl->d_partitions[2].p_offset + sector; - -#ifndef PC98 - bsize = dl->d_partitions[part].p_size; - if (bsize == 0) { - printf("empty partition\n"); - return 1; - } - -#endif - - } -#endif /* RAWBOOT */ - return 0; -} - - -/* - * Be aware that cnt is rounded up to N*BPS - */ -void -devread(char *iodest, int sector, int cnt) -{ - int offset; - char *p; - int dosdev_copy; - - for (offset = 0; offset < cnt; offset += BPS) - { - dosdev_copy = dosdev; - p = Bread(dosdev_copy, sector++); - bcopy(p, iodest+offset, BPS); - } -} - - -static char * -Bread(int dosdev, int sector) -{ - if (dosdev != ra_dev || sector < ra_first || sector >= ra_end) - { - int cyl, head, sec, nsec; - - cyl = sector/spc; -#ifndef PC98 - if (cyl > 1023) { - printf("Error: C:%d > 1023 (BIOS limit)\n", cyl); - for(;;); /* loop forever */ - } -#endif - head = (sector % spc) / spt; - sec = sector % spt; - nsec = spt - sec; - if (nsec > RA_SECTORS) - nsec = RA_SECTORS; - twiddle(); - if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) - { - nsec = 1; - twiddle(); - while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) { - printf("Error: D:0x%x C:%d H:%d S:%d\n", - dosdev, cyl, head, sec); - twiddle(); - } - } - ra_dev = dosdev; - ra_first = sector; - ra_end = sector + nsec; - } - return (ra_buf + (sector - ra_first) * BPS); -} diff --git a/sys/pc98/boot/biosboot/io.c b/sys/pc98/boot/biosboot/io.c deleted file mode 100644 index 3b540dd1c892..000000000000 --- a/sys/pc98/boot/biosboot/io.c +++ /dev/null @@ -1,429 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:35:57 rpd - * $FreeBSD$ - */ - -#include "boot.h" -#include <machine/cpufunc.h> -#include <sys/reboot.h> -#ifdef PC98 -#include "../../pc98/pc98.h" -#endif - - -static int getchar(int in_buf); - -/* - * Gate A20 for high memory - */ -void -gateA20(void) -{ - outb(0xf2, 0x00); - outb(0xf6, 0x02); -} - -/* printf - only handles %d as decimal, %c as char, %s as string */ - -void -printf(const char *format, ...) -{ - int *dataptr = (int *)&format; - char c; - - dataptr++; - while ((c = *format++)) - if (c != '%') - putchar(c); - else - switch (c = *format++) { - case 'd': { - int num = *dataptr++; - char buf[10], *ptr = buf; - if (num<0) { - num = -num; - putchar('-'); - } - do - *ptr++ = '0'+num%10; - while (num /= 10); - do - putchar(*--ptr); - while (ptr != buf); - break; - } - case 'x': { - unsigned int num = *dataptr++, dig; - char buf[8], *ptr = buf; - do - *ptr++ = (dig=(num&0xf)) > 9? - 'a' + dig - 10 : - '0' + dig; - while (num >>= 4); - do - putchar(*--ptr); - while (ptr != buf); - break; - } - case 'c': putchar((*dataptr++)&0xff); break; - case 's': { - char *ptr = (char *)*dataptr++; - while ((c = *ptr++)) - putchar(c); - break; - } - } -} - -void -putchar(int c) -{ - if (c == '\n') - putchar('\r'); - if (loadflags & RB_DUAL) { - putc(c); - serial_putc(c); - } else if (loadflags & RB_SERIAL) - serial_putc(c); - else - putc(c); -} - -static int -getchar(int in_buf) -{ - int c; - -loop: - if (loadflags & RB_DUAL) { - if (ischar()) - c = getc(); - else if (serial_ischar()) - c = serial_getc(); - else - goto loop; - } else if (loadflags & RB_SERIAL) - c = serial_getc(); - else - c = getc(); - if (c == '\r') - c = '\n'; - if (c == '\b') { - if (in_buf != 0) { - putchar('\b'); - putchar(' '); - } else { - goto loop; - } - } - putchar(c); - return(c); -} - -/* - * This routine uses an inb to an unused port, the time to execute that - * inb is approximately 1.25uS. This value is pretty constant across - * all CPU's and all buses, with the exception of some PCI implentations - * that do not forward this I/O adress to the ISA bus as they know it - * is not a valid ISA bus address, those machines execute this inb in - * 60 nS :-(. - * - * XXX this should be converted to use bios_tick. - */ -void -delay1ms(void) -{ -#ifdef PC98 - int i = 800; - while (--i >= 0) - (void)outb(0x5f,0); /* about 600ns */ -#else - int i = 800; - while (--i >= 0) - (void)inb(0x84); -#endif -} - -static __inline int -isch(void) -{ - int isc; - - /* - * Checking the keyboard has the side effect of enabling clock - * interrupts so that bios_tick works. Check the keyboard to - * get this side effect even if we only want the serial status. - */ - isc = ischar(); - - if (loadflags & RB_DUAL) { - if (isc != 0) - return (isc); - } else if (!(loadflags & RB_SERIAL)) - return (isc); - return (serial_ischar()); -} - -static __inline unsigned -pword(unsigned physaddr) -{ -#ifdef PC98 - static int counter = 0; - int i; - - for (i = 0; i < 512; i++) - (void)outb(0x5f, 0); - - return (counter++); -#else - unsigned result; - - /* - * Give the fs prefix separately because gas omits it for - * "movl %fs:0x46c, %eax". - */ - __asm __volatile("fs; movl %1, %0" : "=r" (result) - : "m" (*(unsigned *)physaddr)); - return (result); -#endif -} - -int -gets(char *buf) -{ -#define bios_tick pword(0x46c) -#ifdef PC98 -#define BIOS_TICK_MS 1 -#else -#define BIOS_TICK_MS 55 -#endif - unsigned initial_bios_tick; - char *ptr=buf; - -#if BOOTWAIT - for (initial_bios_tick = bios_tick; - bios_tick - initial_bios_tick < BOOTWAIT / BIOS_TICK_MS;) -#endif - if (isch()) - for (;;) { - switch(*ptr = getchar(ptr - buf) & 0xff) { - case '\n': - case '\r': - *ptr = '\0'; - return 1; - case '\b': - if (ptr > buf) ptr--; - continue; - default: - ptr++; - } -#if TIMEOUT + 0 -#if !BOOTWAIT -#error "TIMEOUT without BOOTWAIT" -#endif - for (initial_bios_tick = bios_tick;;) { - if (isch()) - break; - if (bios_tick - initial_bios_tick >= - TIMEOUT / BIOS_TICK_MS) - return 0; - } -#endif - } - return 0; -} - -int -strcmp(const char *s1, const char *s2) -{ - while (*s1 == *s2) { - if (!*s1++) - return 0; - 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 -bcopy(const void *from, void *to, size_t len) -{ - char *fp = (char *)from; - char *tp = (char *)to; - - while (len-- > 0) - *tp++ = *fp++; -} - -/* To quote Ken: "You are not expected to understand this." :) */ - -void -twiddle(void) -{ - putchar((char)tw_chars); - tw_chars = (tw_chars >> 8) | ((tw_chars & (unsigned long)0xFF) << 24); - putchar('\b'); -} - -static unsigned short *Crtat = (unsigned short *)0; -static int row; -static int col; - -void putc(int c) -{ - static unsigned short *crtat; - unsigned char sys_type; - unsigned short *cp; - int i, pos; - - if (Crtat == 0) { - sys_type = *(unsigned char *)V(0xA1501); - if (sys_type & 0x08) { - Crtat = (unsigned short *)V(0xE0000); - crtat = Crtat; - row = 31; - col = 80; - } else { - Crtat = (unsigned short *)V(0xA0000); - crtat = Crtat; - row = 25; - col = 80; - } - } - - switch(c) { - case '\t': - do { - putc(' '); - } while ((int)crtat % 16); - break; - case '\b': - crtat--; - break; - case '\r': - crtat -= (crtat - Crtat) % col; - break; - case '\n': - crtat += col; - break; - default: - *crtat = (c == 0x5c ? 0xfc : c); - *(crtat++ + 0x1000) = 0xe1; - break; - } - - if (crtat >= Crtat + col * row) { - cp = Crtat; - for (i = 1; i < row; i++) { - bcopy((void *)(cp+col), (void *)cp, col*2); - cp += col; - } - for (i = 0; i < col; i++) { - *cp++ = ' '; - } - crtat -= col; - } - pos = crtat - Crtat; - while((inb(0x60) & 0x04) == 0) {} - outb(0x62, 0x49); - outb(0x60, pos & 0xff); - outb(0x60, pos >> 8); -} - -void machine_check(void) -{ - int ret; - int i; - int data = 0; - u_char epson_machine_id = *(unsigned char *)V(0xA1624); - - /* PC98_SYSTEM_PARAMETER(0x501) */ - ret = ((*(unsigned char*)V(0xA1501)) & 0x08) >> 3; - - /* Wait V-SYNC */ - while (inb(0x60) & 0x20) {} - while (!(inb(0x60) & 0x20)) {} - - /* ANK 'A' font */ - outb(0xa1, 0x00); - outb(0xa3, 0x41); - - /* M_NORMAL, use CG window (all NEC OK) */ - /* sum */ - for (i = 0; i < 4; i++) { - data += *((unsigned long*)V(0xA4000) + i);/* 0xa4000 */ - } - if (data == 0x6efc58fc) { /* DA data */ - ret |= M_NEC_PC98; - } else { - ret |= M_EPSON_PC98; - } - ret |= (inb(0x42) & 0x20) ? M_8M : 0; - - /* PC98_SYSTEM_PARAMETER(0x400) */ - if ((*(unsigned char*)V(0xA1400)) & 0x80) { - ret |= M_NOTE; - } - if (ret & M_NEC_PC98) { - /* PC98_SYSTEM_PARAMETER(0x458) */ - if ((*(unsigned char*)V(0xA1458)) & 0x80) { - ret |= M_H98; - } else { - ret |= M_NOT_H98; - } - } else { - ret |= M_NOT_H98; - switch (epson_machine_id) { - case 0x20: /* note A */ - case 0x22: /* note W */ - case 0x27: /* note AE */ - case 0x2a: /* note WR */ - ret |= M_NOTE; - break; - default: - break; - } - } - (*(unsigned long *)V(0xA1620)) = ret; -} diff --git a/sys/pc98/boot/biosboot/probe_keyboard.c b/sys/pc98/boot/biosboot/probe_keyboard.c deleted file mode 100644 index 24504301d424..000000000000 --- a/sys/pc98/boot/biosboot/probe_keyboard.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) KATO Takenori, 1994-1995. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "boot.h" - -int probe_keyboard(void) -{ - /* - * New type (RA and later) keyboard only! - */ - if (*(unsigned char*)V(0xA1481) & 0x48) - return 0; - return 1; /* keyboard not found */ -} - diff --git a/sys/pc98/boot/biosboot/serial.S b/sys/pc98/boot/biosboot/serial.S deleted file mode 100644 index f2df31aec6cf..000000000000 --- a/sys/pc98/boot/biosboot/serial.S +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $FreeBSD$ - */ - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -/* - * Serial bootblock interface routines - * Copyright (c) 1994, J"org Wunsch - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * THE AUTHOR ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. THE AUTHOR DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - */ - -#if COMCONSOLE == 0x238 -#include "../../../i386/boot/biosboot/serial.S" -#else -/* - * modified for PC-98 by KATO T. of Nagoya University - */ - - .file "serial.S" - -#include <i386/isa/sioreg.h> -#include "asm.h" - - .text - -/* - * The serial port interface routines implement a simple polled i/o - * interface to a standard serial port. Due to the space restrictions - * for the boot blocks, no BIOS support is used (since BIOS requires - * expensive real/protected mode switches), instead the rudimentary - * BIOS support is duplicated here. - * - * The base address for the i/o port is passed from the Makefile in - * the COMCONSOLE preprocessor macro. Console parameters are currently - * hard-coded to 9600 Bd, 8 bit. This can be changed in the - * init_serial() function. - */ - -/* - * void serial_putc(char ch) - * send ch to serial port - * - */ - -ENTRY(serial_putc) - mov $COMCONSOLE + 2, %edx # line status reg -1: inb %dx, %al - testb $0x01, %al - jz 1b # TX buffer not empty - - movb 0x4(%esp), %al - - sub $2, %edx # TX output reg - outb %al, %dx # send this one - - ret - -/* - * int serial_getc(void) - * read a character from serial port - */ - -ENTRY(serial_getc) - mov $COMCONSOLE + 2, %edx # line status reg -1: - inb %dx, %al - testb $0x02, %al - jz 1b # no RX char available - - xorb %eax, %eax - subb $2, %edx # RX buffer reg - inb %dx, %al # fetch (first) character - - cmp $0x7F, %eax # make DEL... - jne 2f - movb $0x08, %eax # look like BS -2: - ret - -/* - * int serial_ischar(void) - * if there is a character pending, return true; otherwise return 0 - */ -ENTRY(serial_ischar) - xorl %eax, %eax - movl $COMCONSOLE + 2, %edx # line status reg - inb %dx, %al - andb $0x02, %al # RX char available? - - ret - -/* - * void init_serial(void) - * initialize the serial console port to 9600 Bd, 8 bpc - */ -ENTRY(init_serial) - /* set 8253 */ - movb 0xb6, %al - outb %al, $0x77 - movl $COMCONSOLE_CLK, %eax - outb %al, $0x75 - inb $0x5f, %al - movb %ah, %al - outb %al, $0x75 - - /* inhibit com int */ - inb $0x35, %al - andb $0xf8, %al - movb %al, %ah - inb $0x5f, %al - movb %ah, %al - outb %al, $0x35 - - inb $0x02, %al - orb $0x10, %al - outb %al, $0x02 - - /* dummy command */ - xorb %al,%al - movl $COMCONSOLE + 2, %edx - outb %al, %dx - inb $0x5f, %al - xorb %al,%al - outb %al, %dx - inb $0x5f, %al - xorb %al,%al - outb %al, %dx - inb $0x5f, %al - - /* RESET 8251 */ - movb $0x40, %al - outb %al, %dx - - movb $COMCONSOLE_MODE , %al - andb $0xfc, %al - orb $0x02, %al /* factor = 1/16 */ - outb %al, %dx - inb $0x5f, %al - - /* start RS-232C */ - movb $0x37, %al - outb %al, %dx - - ret -#endif diff --git a/sys/pc98/boot/biosboot/start.S b/sys/pc98/boot/biosboot/start.S deleted file mode 100644 index a7e69355d621..000000000000 --- a/sys/pc98/boot/biosboot/start.S +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:36:29 rpd - * $FreeBSD$ - */ - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -/* - * Ported to PC-9801 by Yoshio Kimura - */ - -#include "asm.h" - - .file "start.S" - -SIGNATURE= 0xaa55 -LOADSZ= 8192 /* size of unix boot */ - -NAMEBLOCKMAGIC= 0xfadefeed /* value of magicnumebr for block2 */ - -/* - * This DEBUGMSG(msg) macro may be useful for debugging. Its use is - * restricted to this file since it only works in real mode. - */ -#define DEBUGMSG(msg) \ - data32 ; \ - mov $msg, %esi ; \ - data32 ; \ - call message - - .text - .globl start - -ENTRY(boot1) - jmp start - -boot_cyl: - .word 0 - String "IPL1 " - -start: - /* set up %ds */ - xor %ax, %ax - mov %ax, %ds - - /* set up %ss and %esp */ - data32 - mov $BOOTSEG, %eax - mov %ax, %ss - /* - * make a little room on the stack for - * us to save the default bootstring we might find.. - * effectively, we push the bootstring. - */ - data32 - mov $BOOTSTACK-64, %esp - - /* set up %es, (where we will load boot2 to) */ - mov %ax, %es - - push %es - push %cx - push %dx - - data32 - mov $0xa000, %eax - mov %ax, %es - - addr32 - movb 0x501, %al - testb $0x08, %al - jnz hireso -normal: - /* set up graphic screen */ - movb $0x42, %ah - movb $0xc0, %ch - int $0x18 - movb $0x40, %ah - int $0x18 - - data32 - mov $0x0a00, %eax /* 80 x 25 mode */ - jmp 1f -hireso: - movb $0x08, %al /* set up RAM window */ - outb %al, $0x91 - movb $0x0a, %al - outb %al, $0x93 - data32 - mov $0x0a10, %ax /* 80 x 31 mode */ -1: - int $0x18 - movb $0x0c, %ah /* text on */ - int $0x18 - - /* cursor home and on */ - xor %edx, %edx - movb $0x13, %ah - int $0x18 - movb $0x11, %ah - int $0x18 - - /* highreso no supported */ - addr32 - movb 0x501, %al - testb $0x08, %al - jz nothireso - - data32 - mov $ehireso, %esi - data32 - call message - hlt - -nothireso: - /* keyboad reset */ - movb $0x03, %ah - int $0x18 - - /* transfer PC-9801 system common area to 0xa1000 */ - data32 - mov $0x0000, %esi - data32 - mov $0x1000, %edi - data32 - mov $0x0630, %ecx - cld - rep - movsb - - /* transfer EPSON machine type to 0xa1200 */ - push %ds - data32 - mov $0xfd00, %eax - mov %ax, %ds - addr32 - data32 - mov 0x804, %eax - data32 - and $0x00ffffff, %eax - addr32 - data32 - .byte 0x26 - mov %eax, %es: (0x1624) - - pop %ds - pop %dx - pop %cx - pop %es - - /* bootstrap passes */ - mov %cs, %bx - data32 - cmp $0x1fe0, %ebx - jz fd - data32 - cmp $0x1fc0, %ebx - jnz hd - data32 - mov %ebp, %ecx - data32 - mov %ebp, %edx - addr32 - movb 0x584, %al - andb $0xf0, %al - cmpb $0x30, %al - jz fd - cmpb $0x90, %al - jnz hd -fd: - data32 - mov $0x0200, %ecx - data32 - mov $0x0001, %edx - movb $0xd6, %ah - jmp load -hd: - data32 - and %ecx, %ecx - jnz 1f - addr32 - data32 - mov %cs: (boot_cyl), %ecx -1: - movb $0x06, %ah - -/* - * BIOS call "INT 0x1B Function 0xn6" to read sectors from disk into memory - * Call with %ah = 0xd6(for floppy disk) or 0x06(for hard disk) - * %al = DA/UA - * %bx = data length - * %ch = sector size(for floppy) or cylinder(for hard) - * %cl = cylinder - * %dh = head - * %dl = sector - * %es:%bp = segment:offset of buffer - * Return: - * %ah = 0x0 on success; err code on failure - */ - -load: -#ifdef NAMEBLOCK -/* - * Load the second sector and see if it is a boot instruction block. - * If it is then scan the contents for the first valid string and copy it to - * the location of the default boot string.. then zero it out. - * Finally write the block back to disk with the zero'd out entry.. - * I hate writing at this stage but we need this to be persistant. - * If the boot fails, then the next boot will get the next string. - * /etc/rc will regenerate a complete block2 iff the boot succeeds. - * - * Format of block 2 is: - * [NAMEBLOCKMAGIC] <--0xdeafc0de - * [nulls] - * [bootstring]NULL <---e.g. 0:wd(0,a)/kernel.experimental - * [bootstring]NULL <---e.g. 0:wd(0,a)/kernel.old - * .... - * [bootstring]NULL <---e.g. 0:wd(0,f)/kernel - * FF FF FF - */ -where: - /* - * save things we might smash - * (that are not smashed immedatly after us anyway.) - */ - data32 - push %ecx /* preserve 'cyl,sector ' */ - data32 - push %edx -/* - * Load the second sector - * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory - * Call with %ah = 0x2 - * %al = number of sectors - * %ch = cylinder - * %cl = sector - * %dh = head - * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) - * %es:%bx = segment:offset of buffer - * Return: - * %al = 0x0 on success; err code on failure - */ - data32 - movl $0x0201, %eax /function 2 (read) 1 sector */ - xor %ebx, %ebx /* %bx = 0 */ /* buffer address (ES:0) */ - data32 - movl $0x0002, %ecx /* sector 2, cylinder 0 */ - data32 - andl $0x00ff, %edx /* head 0, drive N */ - int $0x13 - data32 - jb read_error - /* - * confirm that it is one for us - */ - data32 - xorl %ebx, %ebx /* magic number at start of buffer */ - data32 - addr32 - movl %es:(%ebx), %eax - data32 - cmpl $NAMEBLOCKMAGIC, %eax - data32 - jne notours /* not ours so return to caller */ - /* - * scan for a bootstring - * Skip the magic number, and scan till we find a non-null, - * or a -1 - */ - incl %ebx /* quicker and smaller */ - incl %ebx - incl %ebx -scan: - incl %ebx - addr32 - movb %es:(%ebx), %al /* load the next byte */ - testb %al, %al /* and if it is null */ - data32 /* keep scanning (past deleted entries) */ - jz scan - incb %al /* now look for -1 */ - data32 - jz notours /* if we reach the 0xFF then we have finished */ - - /* - * save our settings.. we need them twice.. - */ - data32 - push %ebx - /* - * copy it to the default string location - * which is just above the stack for 64 bytes. - */ - data32 - movl $BOOTSTACK-64, %ecx /* 64 bytes at the top of the stack */ -nxtbyte: - addr32 - movb %es:(%ebx), %al /* get the next byte in */ - addr32 - movb %al, %es:(%ecx) /* and transfer it to the name buffer */ - incl %ebx /* get on with the next byte */ - incl %ecx /* get on with the next byte */ - testb %al, %al /* if it was 0 then quit this */ - data32 - jnz nxtbyte /* and looop if more to do */ - - /* - * restore the saved settings and - * zero it out so next time we don't try it again - */ - data32 - pop %ebx /* get back our starting location */ -#ifdef NAMEBLOCK_WRITEBACK -nxtbyte2: - addr32 - movb %es:(%ebx), %al /* get the byte */ - addr32 - movb $0, %es:(%ebx) /* zero it out */ - data32 - incl %ebx /* point to the next byte */ - testb %al, %al /* check if we have finished.. */ - data32 - jne nxtbyte2 -/* - * Write the second sector back - * Load the second sector - * BIOS call "INT 0x13 Function 0x3" to write sectors from memory to disk - * Call with %ah = 0x3 - * %al = number of sectors - * %ch = cylinder - * %cl = sector - * %dh = head - * %dl = drive (0x80 for hard disk, 0x0 for floppy disk) - * %es:%bx = segment:offset of buffer - * Return: - * %al = 0x0 on success; err code on failure - */ - data32 - movl $0x0301, %eax /* write 1 sector */ - xor %ebx, %ebx /* buffer is at offset 0 */ - data32 - movl $0x0002, %ecx /* block 2 */ - data32 - andl $0xff, %edx /* head 0 */ - int $0x13 - data32 - jnb notours - data32 - mov $eread, %esi - jmp err_stop -#endif /* NAMEBLOCK_WRITEBACK */ - /* - * return to the main-line - */ -notours: - data32 - pop %edx - data32 - pop %ecx -#endif - data32 - mov $LOADSZ, %ebx - addr32 - movb 0x584, %al - xor %ebp, %ebp /* %bp = 0, put it at 0 in the BOOTSEG */ - int $0x1b - jc read_error - - /* - * ljmp to the second stage boot loader (boot2). - * After ljmp, %cs is BOOTSEG and boot1 (512 bytes) will be used - * as an internal buffer "intbuf". - */ - - data32 - ljmp $BOOTSEG, $ EXT(boot2) - -/* - * read_error - */ -read_error: - data32 - mov $eread, %esi -err_stop: - data32 - call message - data32 - jmp stop - -/* - * message: write the error message in %ds:%esi to console - */ -message: - - data32 - push %eax - data32 - push %ebx - push %ds - push %es - data32 - mov $0xe000, %eax - mov %ax, %es - addr32 - mov 0x501, %al - testb $0x08, %al - jnz 1f - data32 - mov $0xa000, %eax - mov %ax, %es -1: - mov %cs, %ax - mov %ax, %ds - addr32 - data32 - mov vram, %edi - data32 - mov $0x00e1, %ebx - cld - -nextb: - lodsb /* load a byte into %al */ - cmpb $0x0, %al - je done - cmpb $0x0d, %al - je cr_code - cmpb $0x0a, %al - je lf_code - addr32 - movb %al, (%edi) - addr32 - movb %bl, 0x2000(%edi) - data32 - inc %edi - data32 - inc %edi - jmp nextb -cr_code: - data32 - add $80, %edi - jmp nextb -lf_code: - data32 - mov %edi, %eax - data32 - mov $80, %edx - data32 - div %ebx - data32 - sub %ebx, %edi - jmp nextb -done: - addr32 - data32 - mov %edi, vram - pop %es - pop %ds - data32 - pop %ebx - data32 - pop %eax - data32 - ret - -stop: hlt - data32 - jmp stop /* halt doesnt actually halt forever */ - -vram: - .long 0 - -/* error messages */ - - -#ifdef DEBUG -one: String "1-\0" -two: String "2-\0" -three: String "3-\0" -four: String "4-\0" -#endif DEBUG -#ifdef NAMEBLOCK_WRITEBACK -ewrite: String "Write error\r\n\0" -#endif /* NAMEBLOCK_WRITEBACK */ -eread: String "Read error\r\n\0" -enoboot: String "No bootable partition\r\n\0" -endofcode: -ehireso: String "Highreso not supported\r\n\0" -/* the last 2 bytes in the sector 0 contain the signature */ - . = EXT(boot1) + 0x1fe - .value SIGNATURE -ENTRY(disklabel) - . = EXT(boot1) + 0x400 diff --git a/sys/pc98/boot/biosboot/sys.c b/sys/pc98/boot/biosboot/sys.c deleted file mode 100644 index 1b138b36d479..000000000000 --- a/sys/pc98/boot/biosboot/sys.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd - * $FreeBSD$ - */ - -/* - * Ported to PC-9801 by Yoshio Kimura - */ - -#include "boot.h" -#include <sys/dirent.h> -#include <sys/reboot.h> - -#if 0 -/* #define BUFSIZE 4096 */ -#define BUFSIZE MAXBSIZE -static char buf[BUFSIZE], fsbuf[SBSIZE], iobuf[MAXBSIZE]; -#endif - -static char biosdrivedigit; - -#define BUFSIZE 8192 -#define MAPBUFSIZE BUFSIZE -static char buf[BUFSIZE], fsbuf[BUFSIZE], iobuf[BUFSIZE]; - -static char mapbuf[MAPBUFSIZE]; -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); - -void -xread(char *addr, int size) -{ - int count = BUFSIZE; - while (size > 0) { - if (BUFSIZE > size) - count = size; - read(buf, count); - pcpy(buf, addr, count); - size -= count; - addr += count; - } -} - -#ifndef RAWBOOT -void -read(char *buffer, int count) -{ - int logno, off, size; - int cnt2, bnum2; - struct fs *fs_copy; - - while (count > 0 && poff < inode.i_size) { - fs_copy = fs; - off = blkoff(fs_copy, poff); - logno = lblkno(fs_copy, poff); - cnt2 = size = blksize(fs_copy, &inode, logno); - bnum2 = fsbtodb(fs_copy, block_map(logno)) + boff; - if ( (!off) && (size <= count)) { - devread(buffer, bnum2, cnt2); - } else { - size -= off; - if (size > count) - size = count; - devread(iobuf, bnum2, cnt2); - bcopy(iobuf+off, buffer, size); - } - buffer += size; - count -= size; - 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); - bcopy(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); - bcopy(iobuf, buffer, count); - } -} -#endif - -static int -find(char *path) -{ - char *rest, ch; - int block, off, loc, ino = ROOTINO; - struct dirent *dp; - char list_only; - - list_only = (path[0] == '?' && path[1] == '\0'); -loop: - devread(iobuf, fsbtodb(fs, ino_to_fsba(fs, ino)) + boff, fs->fs_bsize); - bcopy((void *)&((struct dinode *)iobuf)[ino % fs->fs_inopb], - (void *)&inode.i_din, - sizeof (struct dinode)); - if (!*path) - return 1; - while (*path == '/') - path++; - if (!inode.i_size || ((inode.i_mode&IFMT) != IFDIR)) - return 0; - for (rest = path; (ch = *rest) && ch != '/'; rest++) ; - *rest = 0; - loc = 0; - do { - if (loc >= inode.i_size) { - if (list_only) { - putchar('\n'); - return -1; - } else { - return 0; - } - } - if (!(off = blkoff(fs, loc))) { - block = lblkno(fs, loc); - devread(iobuf, fsbtodb(fs, block_map(block)) + boff, - blksize(fs, &inode, block)); - } - dp = (struct dirent *)(iobuf + off); - loc += dp->d_reclen; - if (dp->d_fileno && list_only) - printf("%s ", dp->d_name); - } while (!dp->d_fileno || strcmp(path, dp->d_name)); - ino = dp->d_fileno; - *(path = rest) = ch; - goto loop; -} - - -static int -block_map(int file_block) -{ - int bnum; - if (file_block < NDADDR) - return(inode.i_db[file_block]); - if ((bnum=fsbtodb(fs, inode.i_ib[0])+boff) != mapblock) { - devread(mapbuf, bnum, fs->fs_bsize); - mapblock = bnum; - } - return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]); -} - - -int -openrd(void) -{ - char **devp, *name0 = name, *cp = name0; - int biosdrive, dosdev_copy, ret; - - /*******************************************************\ - * If bracket given look for preceding device name * - \*******************************************************/ - while (*cp && *cp!='(') - cp++; - if (!*cp) - { - cp = name0; - } - else - { - /* - * Look for a BIOS drive number (a leading digit followed - * by a colon). - */ - biosdrivedigit = '\0'; - if (*(name0 + 1) == ':' && *name0 >= '0' && *name0 <= '9') { - biosdrivedigit = *name0; - name0 += 2; - } - - if (cp++ != name0) - { - for (devp = devs; *devp; devp++) - if (name0[0] == (*devp)[0] && - name0[1] == (*devp)[1]) - break; - if (!*devp) - { - printf("Unknown device\n"); - return 1; - } - maj = devp-devs; - } - /*******************************************************\ - * Look inside brackets for unit number, and partition * - \*******************************************************/ - /* - * Allow any valid digit as the unit number, as the BIOS - * will complain if the unit number is out of range. - * Restricting the range here prevents the possibilty of using - * BIOSes that support more than 2 units. - * XXX Bad values may cause strange errors, need to check if - * what happens when a value out of range is supplied. - */ - if (*cp >= '0' && *cp <= '9') - unit = *cp++ - '0'; - if (!*cp || (*cp == ',' && !*++cp)) - return 1; - if (*cp >= 'a' && *cp <= 'p') - part = *cp++ - 'a'; - while (*cp && *cp++!=')') ; - if (!*cp) - return 1; - } - biosdrive = biosdrivedigit - '0'; - if (biosdrivedigit == '\0') { -#ifdef PC98 - biosdrive = dosdev & 0x0f; -#else - biosdrive = unit; -#endif -#if BOOT_HD_BIAS > 0 - /* XXX */ - if (maj == 4) - biosdrive += BOOT_HD_BIAS; -#endif - } - switch(maj) - { -#ifdef PC98 - case 4: /* sd */ - dosdev_copy = biosdrive | 0xa0; -#else /* IBM-PC */ - case 0: - case 4: - dosdev_copy = biosdrive | 0x80; -#endif - break; -#ifdef PC98 - case 0: - case 2: - dosdev_copy = (maj << 3) | unit | 0x80; -#else - case 2: - dosdev_copy = biosdrive; -#endif - break; -#ifdef PC98 - case 6:/* 1.44MB FD */ - dosdev_copy = (maj << 3) | unit; - break; -#endif - default: - printf("Unknown device\n"); - return 1; - } - dosdev = dosdev_copy; -#if 0 - /* XXX this is useful, but misplaced. */ - printf("dosdev= %x, biosdrive = %d, unit = %d, maj = %d\n", - dosdev_copy, biosdrive, unit, maj); -#endif - - /***********************************************\ - * Now we know the disk unit and part, * - * Load disk info, (open the device) * - \***********************************************/ - if (devopen()) - return 1; - -#ifndef RAWBOOT - /***********************************************\ - * Load Filesystem info (mount the device) * - \***********************************************/ - devread((char *)(fs = (struct fs *)fsbuf), SBLOCK + boff, SBSIZE); - /***********************************************\ - * Find the actual FILE on the mounted device * - \***********************************************/ - ret = find(cp); - name = cp; - if (ret == 0) - return 1; - if (ret < 0) { - name = NULL; - return -1; - } - poff = 0; -#endif /* RAWBOOT */ - return 0; -} diff --git a/sys/pc98/boot/biosboot/table.c b/sys/pc98/boot/biosboot/table.c deleted file mode 100644 index 81dc130a0314..000000000000 --- a/sys/pc98/boot/biosboot/table.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - * - * from: Mach, Revision 2.2 92/04/04 11:36:43 rpd - * $FreeBSD$ - */ - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "boot.h" - -/* Segment Descriptor - * - * 31 24 19 16 7 0 - * ------------------------------------------------------------ - * | | |B| |A| | | |1|0|E|W|A| | - * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 | - * | | |D| |L| 19..16| | |1|1|C|R|A| | - * ------------------------------------------------------------ - * | | | - * | BASE 15..0 | LIMIT 15..0 | - * | | | - * ------------------------------------------------------------ - */ - -struct seg_desc { - unsigned short limit_15_0; - unsigned short base_15_0; - unsigned char base_23_16; - unsigned char p_dpl_type; - unsigned char g_b_a_limit; - unsigned char base_31_24; - }; - -#define RUN 0 /* not really 0, but filled in at boot time */ - -struct seg_desc Gdt[] = { - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */ - {0xFFFF, 0x0, 0x0, 0x9F, 0xCF, 0x0}, /* 0x08 : kernel code */ - /* 0x9E? */ - {0xFFFF, 0x0, 0x0, 0x93, 0xCF, 0x0}, /* 0x10 : kernel data */ - /* 0x92? */ - {0xFFFF, RUN, RUN, 0x9E, 0x40, 0x0}, /* 0x18 : boot code */ -#ifdef PC98 - /* - * The limit of boot data should be more than or equal to 0x9FFFF - * for saving BIOS parameter and EPSON machine ID into 2'nd T-VRAM, - * because base address is normally 0x10000. - */ - {0xFFFF, RUN, RUN, 0x92, 0x4F, 0x0}, /* 0x20 : boot data */ -#else - {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* 0x20 : boot data */ -#endif - {0xFFFF, RUN, RUN, 0x9E, 0x0, 0x0}, /* 0x28 : boot code, 16 bits */ - {0xFFFF, 0x0, 0x0, 0x92, 0x0, 0x0}, /* 0x30 : boot data, 16 bits */ -#ifdef BDE_DEBUGGER - /* More for bdb. */ - {}, /* BIOS_TMP_INDEX = 7 : null */ - {}, /* TSS_INDEX = 8 : null */ - {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* DS_286_INDEX = 9 */ - {0xFFFF, 0x0, 0x0, 0xB2, 0x40, 0x0}, /* ES_286_INDEX = 10 */ - {}, /* Unused = 11 : null */ - {0x7FFF, 0x8000, 0xB, 0xB2, 0x40, 0x0}, /* COLOR_INDEX = 12 */ - {0x7FFF, 0x0, 0xB, 0xB2, 0x40, 0x0}, /* MONO_INDEX = 13 */ - {0xFFFF, RUN, RUN, 0x9A, 0x40, 0x0}, /* DB_CS_INDEX = 14 */ - {0xFFFF, RUN, RUN, 0x9A, 0x0, 0x0}, /* DB_CS16_INDEX = 15 */ - {0xFFFF, RUN, RUN, 0x92, 0x40, 0x0}, /* DB_DS_INDEX = 16 */ - {8*18-1, RUN, RUN, 0x92, 0x40, 0x0}, /* GDT_INDEX = 17 */ -#endif /* BDE_DEBUGGER */ -}; - -#ifdef BDE_DEBUGGER -struct idt_desc { - unsigned short entry_15_0; - unsigned short selector; - unsigned char padding; - unsigned char p_dpl_type; - unsigned short entry_31_16; -}; - -struct idt_desc Idt[] = { - {}, /* Null (int 0) */ - {RUN, 0x70, 0, 0x8E, 0}, /* DEBUG_VECTOR = 1 */ - {}, /* Null (int 2) */ - {RUN, 0x70, 0, 0xEE, 0}, /* BREAKPOINT_VECTOR = 3 */ -}; -#endif /* BDE_DEBUGGER */ - -struct pseudo_desc { - unsigned short limit; - unsigned short base_low; - unsigned short base_high; - }; - -struct pseudo_desc Gdtr = { sizeof Gdt - 1, RUN, RUN }; -#ifdef BDE_DEBUGGER -struct pseudo_desc Idtr_prot = { sizeof Idt - 1, RUN, RUN }; -struct pseudo_desc Idtr_real = { 0x400 - 1, 0x0, 0x0 }; -#endif - -/* - * All initialized data is defined in one file to reduce space wastage from - * fragmentation. - */ -char *devs[] = { "wd", "dk", "fd", "wt", "da", 0 }; -unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */ diff --git a/sys/pc98/boot/kzipboot/Makefile b/sys/pc98/boot/kzipboot/Makefile deleted file mode 100644 index 6bf04e18bdde..000000000000 --- a/sys/pc98/boot/kzipboot/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $FreeBSD$ - -PROG= kztail.o kzhead.o -BINMODE = 444 # target is a relocatable object -SRCS= tail.S head.S boot.c unzip.c misc.c malloc.c inflate.c -OBJS_KZHEAD= head.o -OBJS_KZTAIL= tail.o boot.o unzip.o misc.o malloc.o inflate.o -BINDIR= /usr/lib/aout -.PATH: ${.CURDIR}/../../../kern -NOMAN= toobad - -# Where to load the kernel -KADDR = 0x100000 - -# What segment our code lives in -CSEG = 0x8 - -STRIP= # very important!! don't let kz*.o be stripped - -CFLAGS+= -DKADDR=$(KADDR) -DCSEG=$(CSEG) -CFLAGS+= -DKZIP -DCOMCONSOLE=0x30 -CFLAGS+= -DPC98 - -kztail.o: ${OBJS_KZTAIL} - $(LD) -aout -r -x -o kztail.o $(OBJS_KZTAIL) - -kzhead.o: ${OBJS_KZHEAD} - $(LD) -aout -r -x -o kzhead.o $(OBJS_KZHEAD) - -.include <bsd.prog.mk> diff --git a/sys/pc98/boot/kzipboot/README b/sys/pc98/boot/kzipboot/README deleted file mode 100644 index 2845cbe1acdc..000000000000 --- a/sys/pc98/boot/kzipboot/README +++ /dev/null @@ -1,49 +0,0 @@ -/* Beware: mostly obsolete info */ - -This is the first (alpha) release of kernel packer/unpacker -for FreeBSD. It is based on xBoot from Linux, but -hardly rewritten. - -It assumes that: -1) The kernel should be loaded at 0x100000 phys address. -2) The CS selector is equal to 8, which is OK for all - current secondary boot programs. - -Run "make install" to install it. It will place -"kzip" shell script into /usr/sbin, and several files -into /usr/libexec/kzip directory. - -Then try to zip your kernel, for example: - - % kzip /kernel - System size is 462848 - Compressed size 247027 - -It will create file /kernel.kz: - - % ls -l /kernel /kernel.kz - -rwxr-xr-x 1 root 497297 Oct 8 12:41 /386bsd - -rwxrwxr-x 1 root 262144 Oct 8 13:37 /386bsd.kz - -Then rename /kernel.kz to /kernel and reboot. - - % mv /kernel /o3kernel - % mv /kernel.kz /kernel - % sync - % reboot - -During booting, you will see the message: - - Uncompressing kernel...done - Booting the kernel - -The packed kernel should load and run. - -The main problem with packed kernel is the lack of symbol table, -so all commands that require it, will not run. -Among them: ps, savecore, *stat, etc. - -Packed kernels are good for install and fixit floppies. - -Serge Vakulenko, <vak@zebub.msk.su> -Opdated for FreeBSD 2.1 by Gary Jennejohn 12FEB95 diff --git a/sys/pc98/boot/kzipboot/boot.c b/sys/pc98/boot/kzipboot/boot.c deleted file mode 100644 index 2f768e2f7f07..000000000000 --- a/sys/pc98/boot/kzipboot/boot.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * FreeBSD kernel unpacker. - * 1993 by Serge Vakulenko - * modified for FreeBSD 2.1 by Gary Jennejohn - 12FEB95 - */ - -/* - * FreeBSD(98) port - * 1995 by KATO T. of Nagoya University - */ - -#include <sys/types.h> -#include <sys/reboot.h> /* for RB_SERIAL */ - -#include <machine/cpufunc.h> /* for inb/outb */ - -short *videomem; -int curs; -int cols; -int lines; -unsigned int port; - -#ifdef PC98 -unsigned char bios[0x200]; -#else -unsigned char bios[0x100]; -#endif - -extern int end, edata; -void *storage; -void *inbuf; -void *outbuf; -void *window; - -void decompress_kernel (void *dest); - -int memcmp (const void *arg1, const void *arg2, unsigned len) -{ - unsigned char *a = (unsigned char*) arg1; - unsigned char *b = (unsigned char*) arg2; - - for (; len-- > 0; ++a, ++b) - if (*a < *b) - return (-1); - else if (*a > *b) - return (1); - return (0); -} - -void *memcpy (void *to, const void *from, unsigned len) -{ - char *f = (char*) from; - char *t = (char*) to; - - while (len-- > 0) - *t++ = *f++; - return (to); -} - -void serial_putchar (unsigned char c) -{ - unsigned char stat; - - if (c == '\n') - serial_putchar('\r'); -#ifdef PC98 - do { - stat = inb (COMCONSOLE+2); - } while (!(stat & 0x01)); -#else - do { - stat = inb (COMCONSOLE+5); - } while (!(stat & 0x20)); -#endif - - outb (COMCONSOLE, c); -} - -void putchar (unsigned char c) -{ - switch (c) { - case '\n': curs = (curs + cols) / cols * cols; break; -#ifdef PC98 - default: videomem[curs++] = (c == 0x5c ? 0xfc : c); break; -#else - default: videomem[curs++] = 0x0700 | c; break; -#endif - } - while (curs >= cols*lines) { - int col; - - memcpy (videomem, videomem+cols, (lines-1) * cols * 2); - for (col = 0; col < cols; col++) -#ifdef PC98 - videomem[(lines - 1) * cols + col] = 0x20; -#else - videomem[(lines - 1) * cols + col] = 0x720; -#endif - curs -= cols; - } - /* set cursor position */ -#ifdef PC98 - while ((inb(0x60) & 0x04) == 0) {} - outb(0x62, 0x49); - outb(0x60, (curs + 1) & 0xff); - outb(0x60, (curs + 1) >> 8); -#else - outb (port, 0x0e); outb (port+1, curs>>8); - outb (port, 0x0f); outb (port+1, curs); -#endif -} - -int use_serial; - -void putstr (char *s) -{ - while (*s) { - if (use_serial) - serial_putchar (*s++); - else - putchar (*s++); - } -} - -void error (char *s) -{ - putstr ("\n\n"); - putstr (s); - putstr ("\n\n -- System halted"); - while (1); /* Halt */ -} - -void boot (int howto) -{ - int l, c, *p; -#ifdef PC98 - unsigned short gdc_curaddr; - int i; -#endif - /* clear bss */ - for (p = &edata; p < &end; ++p) - *p = 0; - - inbuf = (void *)0x20000; - outbuf = (void *)0x30000; - window = (void *)0x40000; - storage = (void *)0x50000; - - if (!(use_serial = (howto & RB_SERIAL))) { -#ifdef PC98 - videomem = (void*)0xa0000; - cols = 80; - lines = 25; - - /* Is FIFO buffer empty ? */ - while ((inb(0x60) & 0x04) == 0) {} - - outb(0x62, 0xe0); /* CSRR command */ - /* T-GDC busy ? */ - while ((inb(0x60) & 0x01) == 0) {} - /* read cursor address */ - gdc_curaddr = inb(0x62); - gdc_curaddr += (inb(0x62) << 8); - /* ignore rest of data */ - for (i = 0; i < 3; i++) { - (void)inb(0x62); - } - - l = gdc_curaddr / 80 + 1; - c = 0; -#else - /* Test for monochrome video adapter */ - if ((*((unsigned char*) 0x410) & 0x30) == 0x30) - videomem = (void*) 0xb0000; /* monochrome */ - else - videomem = (void*) 0xb8000; /* color */ - - port = *(unsigned short*) 0x463; - cols = *(unsigned short*) 0x44a; - lines = 1 + *(unsigned char*) 0x484; - c = *(unsigned char*) 0x450; - l = *(unsigned char*) 0x451; -#endif - - if (lines < 25) - lines = 25; - curs = l*cols + c; - if (curs > lines*cols) - curs = (lines-1) * cols; - } - - putstr ("Uncompressing kernel..."); - decompress_kernel ((void*) KADDR); - putstr ("done\n"); - putstr ("Booting the kernel\n"); -} diff --git a/sys/pc98/boot/kzipboot/gzip.h b/sys/pc98/boot/kzipboot/gzip.h deleted file mode 100644 index e578532ad8cc..000000000000 --- a/sys/pc98/boot/kzipboot/gzip.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * gzip.h -- common declarations for all gzip modules - * Copyright (C) 1992-1993 Jean-loup Gailly. - * Adapted for FreeBSD boot unpacker by Serge Vakulenko. - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - */ - -typedef unsigned char uchar; -typedef unsigned long ulong; - -#define NULL 0 - -#define STORED 0 /* Compression methods */ -#define COMPRESSED 1 -#define PACKED 2 -#define DEFLATED 8 /* methods 3 to 7 reserved */ - -#define INBUFSIZ 0x8000 /* input buffer size */ - -#define OUTBUFSIZ 16384 /* output buffer size */ -#define OUTBUF_EXTRA 2048 /* required by unlzw() */ - -#define GZIP_MAGIC "\037\213" /* gzip files, 1F 8B */ -#define OLD_GZIP_MAGIC "\037\236" /* gzip 0.5 = freeze 1.x */ -#define PKZIP_MAGIC "PK\003\004" /* pkzip files */ -#define PACK_MAGIC "\037\036" /* packed files */ -#define LZW_MAGIC "\037\235" /* lzw files, 1F 9D */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* file probably ascii text */ -#define CONTINUATION 0x02 /* cont. of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* extra field present */ -#define ORIG_NAME 0x08 /* original file name present */ -#define COMMENT 0x10 /* file comment present */ -#define ENCRYPTED 0x20 /* file is encrypted */ -#define RESERVED 0xC0 /* reserved */ - -/* window size--must be a power of two, and */ -/* at least 32K for zip's deflate method */ -#define WSIZE 0x8000 - -extern int method; /* compression method */ - -extern uchar *inbuf; /* input buffer */ -extern uchar *outbuf; /* output buffer */ -extern uchar *window; /* Sliding window and suffix table (unlzw) */ - -extern unsigned insize; /* valid bytes in inbuf */ -extern unsigned inptr; /* index of next byte to be processed in inbuf */ -extern unsigned outcnt; /* bytes in output buffer */ - -extern int pkzip; /* set for a pkzip file */ -extern int extended; /* set if extended local header */ -extern ulong crc; /* shift register contents */ -extern ulong output_ptr; /* total output bytes */ - -extern void unzip (void); -extern void check_zipfile (void); -extern void updcrc (uchar *s, unsigned n); -extern void clear_bufs (void); -extern void fill_inbuf (void); -extern void flush_window (void); -extern void error (char *m); - -static inline uchar get_byte () -{ - if (inptr >= insize) - fill_inbuf (); - return (inbuf[inptr++]); -} - -static inline void put_char (uchar c) -{ - window[outcnt++] = c; - if (outcnt == WSIZE) - flush_window(); -} diff --git a/sys/pc98/boot/kzipboot/head.S b/sys/pc98/boot/kzipboot/head.S deleted file mode 100644 index 914e5e2a9fac..000000000000 --- a/sys/pc98/boot/kzipboot/head.S +++ /dev/null @@ -1,11 +0,0 @@ -/* - * First module in a kzipped kernel. - * This needs to be at the beginning so that the boot loader calls it. - * It may be overwritten by uncompressing the kernel, so it transfers - * control to a higher address that won't be overwritten. - * - * Copyright (C) Serge Vakulenko - */ - .text -head: - jmp tail diff --git a/sys/pc98/boot/kzipboot/malloc.c b/sys/pc98/boot/kzipboot/malloc.c deleted file mode 100644 index 052e5e357dbb..000000000000 --- a/sys/pc98/boot/kzipboot/malloc.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/types.h> - -extern unsigned char *storage; - -void * -kzipmalloc(nbytes) - size_t nbytes; -{ - unsigned char *p = storage; - storage += nbytes; - if (storage >= (unsigned char *) 0xa0000) { - putstr("warning: malloc wrapped\n"); - p = (unsigned char *) 0x50000; - storage = p + nbytes; - } - return p; -} - -void -kzipfree(cp) - void *cp; -{ -} diff --git a/sys/pc98/boot/kzipboot/misc.c b/sys/pc98/boot/kzipboot/misc.c deleted file mode 100644 index a971aeec8b83..000000000000 --- a/sys/pc98/boot/kzipboot/misc.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * misc.c - * - * This is a collection of several routines from gzip-1.0.3 - * adapted for Linux. - * - * Ported to 386bsd by Serge Vakulenko - */ - -#include "gzip.h" - -unsigned outcnt; -unsigned insize; -unsigned inptr; - -extern const char input_data[]; -extern const int input_len; - -int input_ptr; - -int method; - -char *output_data; -ulong output_ptr; - -void makecrc (void); -void putstr (char *c); -void *memcpy (void *to, const void *from, unsigned len); -int memcmp (const void *arg1, const void *arg2, unsigned len); - -ulong crc; /* shift register contents */ -ulong crc_32_tab[256]; /* crc table, defined below */ - -/* - * Run a set of bytes through the crc shift register. If s is a NULL - * pointer, then initialize the crc shift register contents instead. - * Return the current crc in either case. - */ -void updcrc(s, n) -uchar *s; /* pointer to bytes to pump through */ -unsigned n; /* number of bytes in s[] */ -{ - while (n--) - crc = crc_32_tab[(uchar)crc ^ (*s++)] ^ (crc >> 8); -} - -/* - * Clear input and output buffers - */ -void clear_bufs() -{ - outcnt = 0; - insize = inptr = 0; -} - -/* - * Fill the input buffer. This is called only when the buffer is empty - * and at least one byte is really needed. - */ -void fill_inbuf () -{ - int len, i; - - /* Read as much as possible */ - insize = 0; - do { - len = INBUFSIZ - insize; - if (len > input_len - input_ptr + 1) - len = input_len-input_ptr+1; - if (len <= 0) - break; - for (i=0; i<len; i++) - inbuf[insize+i] = input_data[input_ptr+i]; - insize += len; - input_ptr += len; - } while (insize < INBUFSIZ); - if (insize == 0) - error("unable to fill buffer"); - inptr = 0; -} - -/* - * Write the output window window[0..outcnt-1] and update crc and bytes_out. - * (Used for the decompressed data only.) - */ -void flush_window() -{ - if (outcnt == 0) return; - updcrc(window, outcnt); - - memcpy(&output_data[output_ptr], (char *)window, outcnt); - - output_ptr += outcnt; - outcnt = 0; -} - -/* - * Code to compute the CRC-32 table. Borrowed from - * gzip-1.0.3/makecrc.c. - * Not copyrighted 1990 Mark Adler - */ -void makecrc(void) -{ - ulong c; /* crc shift register */ - ulong e; /* polynomial exclusive-or pattern */ - int i; /* counter for all possible eight bit values */ - int k; /* byte being shifted into crc apparatus */ - - /* terms of polynomial defining this crc (except x^32): */ - static const uchar poly[] = { 0,1,2,4,5,7,8,10,11,12,16,22,23,26, }; - - /* Make exclusive-or pattern from polynomial */ - e = 0; - for (i = 0; i < sizeof(poly)/sizeof(*poly); i++) - e |= 1L << (31 - poly[i]); - - crc_32_tab[0] = 0; - - for (i = 1; i < 256; i++) { - c = 0; - for (k = i | 256; k != 1; k >>= 1) { - c = c & 1 ? (c >> 1) ^ e : c >> 1; - if (k & 1) - c ^= e; - } - crc_32_tab[i] = c; - } -} - -/* - * Check the magic number of the input file and update ofname if an - * original name was given and to_stdout is not set. - * Set inptr to the offset of the next byte to be processed. - */ -static void get_method() -{ - uchar flags; - char magic[2]; /* magic header */ - - magic[0] = get_byte(); - magic[1] = get_byte(); - - method = -1; /* unknown yet */ - extended = pkzip = 0; - /* assume multiple members in gzip file except for record oriented I/O */ - - if (memcmp(magic, GZIP_MAGIC, 2) == 0 - || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) { - method = get_byte(); - flags = get_byte(); - if (flags & ENCRYPTED) - error("Input is encrypted"); - if (flags & CONTINUATION) - error("Multi part input"); - if (flags & RESERVED) - error("Input has invalid flags"); - - (void) get_byte(); /* Get timestamp */ - (void) get_byte(); - (void) get_byte(); - (void) get_byte(); - - (void) get_byte(); /* Ignore extra flags for the moment */ - (void) get_byte(); /* Ignore OS type for the moment */ - - if (flags & EXTRA_FIELD) { - unsigned len = get_byte(); - len |= get_byte() << 8; - while (len--) - (void) get_byte(); - } - - /* Discard file comment if any */ - if (flags & COMMENT) - while (get_byte()) - continue; - - } else if (memcmp(magic, PKZIP_MAGIC, 2) == 0 && inptr == 2 - && memcmp(inbuf, PKZIP_MAGIC, 4) == 0) { - /* - * To simplify the code, we support a zip file when alone only. - * We are thus guaranteed that the entire local header fits in inbuf. - */ - inptr = 0; - check_zipfile(); - - } else if (memcmp(magic, PACK_MAGIC, 2) == 0) - error("packed input"); - else if (memcmp(magic, LZW_MAGIC, 2) == 0) - error("compressed input"); - if (method == -1) - error("Corrupted input"); -} - -void -decompress_kernel (void *dest) -{ - output_data = dest; - output_ptr = 0; - - input_ptr = 0; - - clear_bufs (); - makecrc (); - get_method (); - unzip (); -} diff --git a/sys/pc98/boot/kzipboot/tail.S b/sys/pc98/boot/kzipboot/tail.S deleted file mode 100644 index 5dcee9c5a89f..000000000000 --- a/sys/pc98/boot/kzipboot/tail.S +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Boot unpacker startup routine. - * Copyright (C) Serge Vakulenko - */ - .text - .globl tail -tail: - cli # disable interrupts - pushl 4(%esp) # pass howto arg - call _boot # unpack the kernel image - popl %eax # discard howto arg - ljmp $CSEG, $KADDR # jump to unpacked kernel diff --git a/sys/pc98/boot/kzipboot/unzip.c b/sys/pc98/boot/kzipboot/unzip.c deleted file mode 100644 index 93a2c8b84279..000000000000 --- a/sys/pc98/boot/kzipboot/unzip.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * unzip.c -- decompress files in gzip or pkzip format. - * Copyright (C) 1992-1993 Jean-loup Gailly - * - * Adapted for Linux booting by Hannu Savolainen 1993 - * Adapted for FreeBSD booting by Serge Vakulenko - * - * This is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License, see the file COPYING. - * - * The code in this file is derived from the file funzip.c written - * and put in the public domain by Mark Adler. - */ - -/* - * This version can extract files in gzip or pkzip format. - * For the latter, only the first entry is extracted, and it has to be - * either deflated or stored. - */ - -#include "gzip.h" - -#include <sys/types.h> -#include <sys/inflate.h> - -/* PKZIP header definitions */ -#define LOCSIG 0x04034b50L /* four-byte lead-in (lsb first) */ -#define LOCFLG 6 /* offset of bit flag */ -#define CRPFLG 1 /* bit for encrypted entry */ -#define EXTFLG 8 /* bit for extended local header */ -#define LOCHOW 8 /* offset of compression method */ -#define LOCTIM 10 /* file mod time (for decryption) */ -#define LOCCRC 14 /* offset of crc */ -#define LOCSIZ 18 /* offset of compressed size */ -#define LOCLEN 22 /* offset of uncompressed length */ -#define LOCFIL 26 /* offset of file name field length */ -#define LOCEXT 28 /* offset of extra field length */ -#define LOCHDR 30 /* size of local header, including sig */ -#define EXTHDR 16 /* size of extended local header, inc sig */ - -int pkzip; /* set for a pkzip file */ -int extended; /* set if extended local header */ - -/* Macros for getting two-byte and four-byte header values */ -#define SH(p) ((ushort)(uchar)((p)[0]) | ((ushort)(uchar)((p)[1]) << 8)) -#define LG(p) ((ulong)(SH(p)) | ((ulong)(SH((p)+2)) << 16)) - -/* - * Check zip file and advance inptr to the start of the compressed data. - * Get ofname from the local header if necessary. - */ -void check_zipfile() -{ - uchar *h = inbuf + inptr; /* first local header */ - - /* Check validity of local header, and skip name and extra fields */ - inptr += LOCHDR + SH(h + LOCFIL) + SH(h + LOCEXT); - - if (inptr > insize || LG(h) != LOCSIG) - error("input not a zip"); - - method = h[LOCHOW]; - if (method != STORED && method != DEFLATED) - error("first entry not deflated or stored--can't extract"); - - /* If entry encrypted, decrypt and validate encryption header */ - if (h[LOCFLG] & CRPFLG) - error("encrypted file"); - - /* Save flags for unzip() */ - extended = (h[LOCFLG] & EXTFLG) != 0; - pkzip = 1; -} - -int -Flush (void *nu, u_char *buf, u_long cnt) -{ - outcnt = cnt; - flush_window(); - return 0; -} - -int -NextByte (void *nu) -{ - return ((int) get_byte ()); -} - -struct inflate infl; /* put it into the BSS */ - -/* - * Unzip in to out. This routine works on both gzip and pkzip files. - * - * IN assertions: the buffer inbuf contains already the beginning of - * the compressed data, from offsets inptr to insize-1 included. - * The magic header has already been checked. The output buffer is cleared. - */ - -void unzip() -{ - ulong orig_crc = 0; /* original crc */ - ulong orig_len = 0; /* original uncompressed length */ - uchar buf[EXTHDR]; /* extended local header */ - int n, res; - - crc = 0xffffffffL; /* initialize crc */ - - if (pkzip && !extended) { /* crc and length at the end otherwise */ - orig_crc = LG(inbuf + LOCCRC); - orig_len = LG(inbuf + LOCLEN); - } - - if (method != DEFLATED) - error("internal error, invalid method"); - infl.gz_input = NextByte; - infl.gz_output = Flush; - infl.gz_slide = window; - res = inflate (&infl); - if (res == 3) - error("out of memory"); - else if (res != 0) - error("invalid compressed format"); - - /* Get the crc and original length */ - if (!pkzip) { - /* crc32 (see algorithm.doc) - * uncompressed input size modulo 2^32 - */ - for (n = 0; n < 8; n++) - buf[n] = get_byte(); /* may cause an error if EOF */ - orig_crc = LG(buf); - orig_len = LG(buf+4); - - } else if (extended) { /* If extended header, check it */ - /* signature - 4bytes: 0x50 0x4b 0x07 0x08 - * CRC-32 value - * compressed size 4-bytes - * uncompressed size 4-bytes - */ - for (n = 0; n < EXTHDR; n++) - buf[n] = get_byte(); /* may cause an error if EOF */ - orig_crc = LG(buf+4); - orig_len = LG(buf+12); - } - - /* Validate decompression */ - if (orig_crc != (crc ^ 0xffffffffL)) - error("crc error"); - if (orig_len != output_ptr) - error("length error"); - - /* Check if there are more entries in a pkzip file */ - if (pkzip && inptr+4 < insize && LG(inbuf+inptr) == LOCSIG) - error("zip file has more than one entry"); -} diff --git a/sys/pc98/boot/netboot/3c509.c b/sys/pc98/boot/netboot/3c509.c deleted file mode 100644 index accc948c6b4f..000000000000 --- a/sys/pc98/boot/netboot/3c509.c +++ /dev/null @@ -1,602 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters. - Date: Mar 22 1995 - - This code is based heavily on David Greenman's if_ed.c driver and - Andres Vega Garcia's if_ep.c driver. - - Copyright (C) 1993-1994, David Greenman, Martin Renters. - Copyright (C) 1993-1995, Andres Vega Garcia. - Copyright (C) 1995, Serge Babkin. - This software may be used, modified, copied, distributed, and sold, in - both source and binary form provided that the above copyright and these - terms are retained. Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - -3c509 support added by Serge Babkin (babkin@hq.icb.chel.su) - -$FreeBSD$ - -***************************************************************************/ - -/* #define EDEBUG */ - -#include "netboot.h" -#include "3c509.h" - -short aui; -char bnc=0, utp=0; /* for 3C509 */ -unsigned short eth_nic_base; -unsigned short eth_asic_base; -unsigned short eth_base; -unsigned char eth_tx_start; -unsigned char eth_laar; -unsigned char eth_flags; -unsigned char eth_vendor; -unsigned char eth_memsize; -unsigned char *eth_bmem; -unsigned char *eth_rmem; -unsigned char *eth_node_addr; - -static send_ID_sequence(); -static get_eeprom_data(); -static get_e(); - -/************************************************************************** -The following two variables are used externally -***************************************************************************/ -char packet[ETHER_MAX_LEN]; -int packetlen; - -/*********************** Name of driver *********************************/ - -char eth_driver[]="ep0"; - -/************************************************************************** -ETH_PROBE - Look for an adapter -***************************************************************************/ -eth_probe() -{ - /* common variables */ - int i; - /* variables for 3C509 */ - int data, j, io_base, id_port = EP_ID_PORT; - int nisa = 0, neisa = 0; - u_short k; - int ep_current_tag = EP_LAST_TAG + 1; - short *p; - - eth_vendor = VENDOR_NONE; - - /********************************************************* - Search for 3Com 509 card - ***********************************************************/ - - /* Look for the EISA boards, leave them activated */ - /* search for the first card, ignore all others */ - for(j = 1; j < 16 && eth_vendor==VENDOR_NONE ; j++) { - io_base = (j * EP_EISA_START) | EP_EISA_W0; - if (inw(io_base + EP_W0_MFG_ID) != MFG_ID) - continue; - - /* we must found 0x1f if the board is EISA configurated */ - if ((inw(io_base + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f) - continue; - - /* Reset and Enable the card */ - outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_RESET_ADAPTER); - DELAY(1000); /* we must wait at least 1 ms */ - outb(io_base + EP_W0_CONFIG_CTRL, W0_P4_CMD_ENABLE_ADAPTER); - - /* - * Once activated, all the registers are mapped in the range - * x000 - x00F, where x is the slot number. - */ - eth_base = j * EP_EISA_START; - eth_vendor = VENDOR_3C509; - } - ep_current_tag--; - - /* Look for the ISA boards. Init and leave them actived */ - /* search for the first card, ignore all others */ - outb(id_port, 0xc0); /* Global reset */ - DELAY(1000); - for (i = 0; i < EP_MAX_BOARDS && eth_vendor==VENDOR_NONE; i++) { - outb(id_port, 0); - outb(id_port, 0); - send_ID_sequence(id_port); - - data = get_eeprom_data(id_port, EEPROM_MFG_ID); - if (data != MFG_ID) - break; - - /* resolve contention using the Ethernet address */ - for (j = 0; j < 3; j++) - data = get_eeprom_data(id_port, j); - - eth_base = - (get_eeprom_data(id_port, EEPROM_ADDR_CFG) & 0x1f) * 0x10 + 0x200; - outb(id_port, ep_current_tag); /* tags board */ - outb(id_port, ACTIVATE_ADAPTER_TO_CONFIG); - eth_vendor = VENDOR_3C509; - ep_current_tag--; - } - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - - /* - * The iobase was found and MFG_ID was 0x6d50. PROD_ID should be - * 0x9[0-f]50 - */ - GO_WINDOW(0); - k = get_e(EEPROM_PROD_ID); - if ((k & 0xf0ff) != (PROD_ID & 0xf0ff)) - goto no3c509; - - if(eth_base >= EP_EISA_START) { - printf("3C5x9 board on EISA at 0x%x - ",eth_base); - } else { - printf("3C5x9 board on ISA at 0x%x - ",eth_base); - } - - /* test for presence of connectors */ - i = inw(IS_BASE + EP_W0_CONFIG_CTRL); - j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14; - - switch(j) { - case 0: - if(i & IS_UTP) { - printf("10baseT\r\n"); - utp=1; - } - else { - printf("10baseT not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - case 1: - if(i & IS_AUI) - printf("10base5\r\n"); - else { - printf("10base5 not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - case 3: - if(i & IS_BNC) { - printf("10base2\r\n"); - bnc=1; - } - else { - printf("10base2 not present\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - - break; - default: - printf("unknown connector\r\n"); - eth_vendor=VENDOR_NONE; - goto no3c509; - } - /* - * Read the station address from the eeprom - */ - p = (u_short *) arptable[ARP_CLIENT].node; - for (i = 0; i < 3; i++) { - GO_WINDOW(0); - p[i] = htons(get_e(i)); - GO_WINDOW(2); - outw(BASE + EP_W2_ADDR_0 + (i * 2), ntohs(p[i])); - } - - printf("Ethernet address: "); - for(i=0; i<5; i++) { - printf("%b:",arptable[ARP_CLIENT].node[i]); - } - printf("%b\n",arptable[ARP_CLIENT].node[i]); - - eth_node_addr = arptable[ARP_CLIENT].node; - eth_reset(); - return eth_vendor; -no3c509: - eth_vendor = VENDOR_NONE; - - return VENDOR_NONE; -} - -/************************************************************************** -ETH_RESET - Reset adapter -***************************************************************************/ -eth_reset() -{ - int s, i; - - /*********************************************************** - Reset 3Com 509 card - *************************************************************/ - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - - /* stop card */ - outw(BASE + EP_COMMAND, RX_DISABLE); - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - outw(BASE + EP_COMMAND, TX_DISABLE); - outw(BASE + EP_COMMAND, STOP_TRANSCEIVER); - outw(BASE + EP_COMMAND, RX_RESET); - outw(BASE + EP_COMMAND, TX_RESET); - outw(BASE + EP_COMMAND, C_INTR_LATCH); - outw(BASE + EP_COMMAND, SET_RD_0_MASK); - outw(BASE + EP_COMMAND, SET_INTR_MASK); - outw(BASE + EP_COMMAND, SET_RX_FILTER); - - /* - /* initialize card - */ - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - - GO_WINDOW(0); - - /* Disable the card */ - outw(BASE + EP_W0_CONFIG_CTRL, 0); - - /* Configure IRQ to none */ - outw(BASE + EP_W0_RESOURCE_CFG, SET_IRQ(0)); - - /* Enable the card */ - outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ); - - GO_WINDOW(2); - - /* Reload the ether_addr. */ - for (i = 0; i < 6; i++) - outb(BASE + EP_W2_ADDR_0 + i, arptable[ARP_CLIENT].node[i]); - - outw(BASE + EP_COMMAND, RX_RESET); - outw(BASE + EP_COMMAND, TX_RESET); - - /* Window 1 is operating window */ - GO_WINDOW(1); - for (i = 0; i < 31; i++) - inb(BASE + EP_W1_TX_STATUS); - - /* get rid of stray intr's */ - outw(BASE + EP_COMMAND, ACK_INTR | 0xff); - - outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_5_INTS); - - outw(BASE + EP_COMMAND, SET_INTR_MASK | S_5_INTS); - - outw(BASE + EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | - FIL_BRDCST); - - /* configure BNC */ - if(bnc) { - outw(BASE + EP_COMMAND, START_TRANSCEIVER); - DELAY(1000); - } - /* configure UTP */ - if(utp) { - GO_WINDOW(4); - outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP); - GO_WINDOW(1); - } - - /* start tranciever and receiver */ - outw(BASE + EP_COMMAND, RX_ENABLE); - outw(BASE + EP_COMMAND, TX_ENABLE); - - /* set early threshold for minimal packet length */ - outw(BASE + EP_COMMAND, SET_RX_EARLY_THRESH | 64); - - outw(BASE + EP_COMMAND, SET_TX_START_THRESH | 16); - - return 1; -no3c509: - -} - -/************************************************************************** -ETH_TRANSMIT - Transmit a frame -***************************************************************************/ -static const char padmap[] = { - 0, 3, 2, 1}; - -eth_transmit(d,t,s,p) -char *d; /* Destination */ -unsigned short t; /* Type */ -unsigned short s; /* size */ -char *p; /* Packet */ -{ - register u_int len; - int pad; - int status; - unsigned char c; - - if(eth_vendor != VENDOR_3C509) - goto no3c509; - -#ifdef EDEBUG - printf("{l=%d,t=%x}",s+14,t); -#endif - - /* swap bytes of type */ - t=(( t&0xFF )<<8) | ((t>>8) & 0xFF); - - len=s+14; /* actual length of packet */ - pad = padmap[len & 3]; - - /* - * The 3c509 automatically pads short packets to minimum ethernet length, - * but we drop packets that are too large. Perhaps we should truncate - * them instead? - */ - if (len + pad > ETHER_MAX_LEN) { - return 0; - } - - /* drop acknowledgements */ - while(( status=inb(BASE + EP_W1_TX_STATUS) )& TXS_COMPLETE ) { - if(status & (TXS_UNDERRUN|TXS_MAX_COLLISION|TXS_STATUS_OVERFLOW)) { - outw(BASE + EP_COMMAND, TX_RESET); - outw(BASE + EP_COMMAND, TX_ENABLE); - } - - outb(BASE + EP_W1_TX_STATUS, 0x0); - } - - while (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) { - /* no room in FIFO */ - } - - outw(BASE + EP_W1_TX_PIO_WR_1, len); - outw(BASE + EP_W1_TX_PIO_WR_1, 0x0); /* Second dword meaningless */ - - /* write packet */ - outsw(BASE + EP_W1_TX_PIO_WR_1, d, 3); - outsw(BASE + EP_W1_TX_PIO_WR_1, eth_node_addr, 3); - outw(BASE + EP_W1_TX_PIO_WR_1, t); - outsw(BASE + EP_W1_TX_PIO_WR_1, p, s / 2); - if (s & 1) - outb(BASE + EP_W1_TX_PIO_WR_1, *(p+s - 1)); - - while (pad--) - outb(BASE + EP_W1_TX_PIO_WR_1, 0); /* Padding */ - - /* timeout after sending */ - DELAY(1000); - return 0; -no3c509: -} - -/************************************************************************** -ETH_POLL - Wait for a frame -***************************************************************************/ -eth_poll() -{ - /* common variables */ - unsigned short type = 0; - unsigned short len; - /* variables for 3C509 */ - struct ether_header *eh; - int lenthisone; - short rx_fifo2, status, cst; - register short rx_fifo; - - if(eth_vendor!=VENDOR_3C509) - goto no3c509; - - cst=inw(BASE + EP_STATUS); - -#ifdef EDEBUG - if(cst & 0x1FFF) - printf("-%x-",cst); -#endif - - if( (cst & (S_RX_COMPLETE|S_RX_EARLY) )==0 ) { - /* acknowledge everything */ - outw(BASE + EP_COMMAND, ACK_INTR| (cst & S_5_INTS)); - outw(BASE + EP_COMMAND, C_INTR_LATCH); - - return 0; - } - - status = inw(BASE + EP_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%x*",status); -#endif - - if (status & ERR_RX) { - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - return 0; - } - - rx_fifo = status & RX_BYTES_MASK; - if (rx_fifo==0) - return 0; - - /* read packet */ -#ifdef EDEBUG - printf("[l=%d",rx_fifo); -#endif - insw(BASE + EP_W1_RX_PIO_RD_1, packet, rx_fifo / 2); - if(rx_fifo & 1) - packet[rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1); - packetlen=rx_fifo; - - while(1) { - status = inw(BASE + EP_W1_RX_STATUS); -#ifdef EDEBUG - printf("*%x*",status); -#endif - rx_fifo = status & RX_BYTES_MASK; - - if(rx_fifo>0) { - insw(BASE + EP_W1_RX_PIO_RD_1, packet+packetlen, rx_fifo / 2); - if(rx_fifo & 1) - packet[packetlen+rx_fifo-1]=inb(BASE + EP_W1_RX_PIO_RD_1); - packetlen+=rx_fifo; -#ifdef EDEBUG - printf("+%d",rx_fifo); -#endif - } - - if(( status & RX_INCOMPLETE )==0) { -#ifdef EDEBUG - printf("=%d",packetlen); -#endif - break; - } - - DELAY(1000); - } - - /* acknowledge reception of packet */ - outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK); - while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS); - - type = (packet[12]<<8) | packet[13]; - -#ifdef EDEBUG - if(packet[0]+packet[1]+packet[2]+packet[3]+packet[4]+ - packet[5] == 0xFF*6) - printf(",t=0x%x,b]",type); - else - printf(",t=0x%x]",type); -#endif - - - if (type == ARP) { - struct arprequest *arpreq; - unsigned long reqip; - - arpreq = (struct arprequest *)&packet[ETHER_HDR_LEN]; - -#ifdef EDEBUG - printf("(ARP %I->%I)",ntohl(*(int*)arpreq->sipaddr), - ntohl(*(int*)arpreq->tipaddr)); -#endif - - convert_ipaddr(&reqip, arpreq->tipaddr); - if ((ntohs(arpreq->opcode) == ARP_REQUEST) && - (reqip == arptable[ARP_CLIENT].ipaddr)) { - arpreq->opcode = htons(ARP_REPLY); - bcopy(arpreq->sipaddr, arpreq->tipaddr, 4); - bcopy(arpreq->shwaddr, arpreq->thwaddr, 6); - bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6); - convert_ipaddr(arpreq->sipaddr, &reqip); - eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest), - arpreq); - return(0); - } - } else if(type==IP) { - struct iphdr *iph; - - iph = (struct iphdr *)&packet[ETHER_HDR_LEN]; -#ifdef EDEBUG - printf("(IP %I-%d->%I)",ntohl(*(int*)iph->src), - ntohs(iph->protocol),ntohl(*(int*)iph->dest)); -#endif - } - - return 1; - -no3c509: -} - - -/************************************************************************* - 3Com 509 - specific routines -**************************************************************************/ - -static int -eeprom_rdy() -{ - int i; - - for (i = 0; is_eeprom_busy(IS_BASE) && i < MAX_EEPROMBUSY; i++); - if (i >= MAX_EEPROMBUSY) { - printf("3c509: eeprom failed to come ready.\r\n"); - return (0); - } - return (1); -} - -/* - * get_e: gets a 16 bits word from the EEPROM. we must have set the window - * before - */ -static int -get_e(offset) -int offset; -{ - if (!eeprom_rdy()) - return (0xffff); - outw(IS_BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset); - if (!eeprom_rdy()) - return (0xffff); - return (inw(IS_BASE + EP_W0_EEPROM_DATA)); -} - -static int -send_ID_sequence(port) -int port; -{ - int cx, al; - - for (al = 0xff, cx = 0; cx < 255; cx++) { - outb(port, al); - al <<= 1; - if (al & 0x100) - al ^= 0xcf; - } - return (1); -} - - -/* - * We get eeprom data from the id_port given an offset into the eeprom. - * Basically; after the ID_sequence is sent to all of the cards; they enter - * the ID_CMD state where they will accept command requests. 0x80-0xbf loads - * the eeprom data. We then read the port 16 times and with every read; the - * cards check for contention (ie: if one card writes a 0 bit and another - * writes a 1 bit then the host sees a 0. At the end of the cycle; each card - * compares the data on the bus; if there is a difference then that card goes - * into ID_WAIT state again). In the meantime; one bit of data is returned in - * the AX register which is conveniently returned to us by inb(). Hence; we - * read 16 times getting one bit of data with each read. - */ -static int -get_eeprom_data(id_port, offset) -int id_port; -int offset; -{ - int i, data = 0; - outb(id_port, 0x80 + offset); - DELAY(1000); - for (i = 0; i < 16; i++) - data = (data << 1) | (inw(id_port) & 1); - return (data); -} - -/* a surrogate */ - -DELAY(val) -{ - int c; - - for(c=0; c<val; c+=20) { - twiddle(); - } -} - diff --git a/sys/pc98/boot/netboot/3c509.h b/sys/pc98/boot/netboot/3c509.h deleted file mode 100644 index 8bfa36812d82..000000000000 --- a/sys/pc98/boot/netboot/3c509.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. 2. The name - * of the author may not be used to endorse or promote products derived from - * this software withough specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by: - * - October 2, 1994 - - Modified by: Andres Vega Garcia - - INRIA - Sophia Antipolis, France - e-mail: avega@sophia.inria.fr - finger: avega@pax.inria.fr - - */ - -/* - * Ethernet software status per interface. - */ -/* - * Some global constants - */ -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 - -#define TX_INIT_RATE 16 -#define TX_INIT_MAX_RATE 64 -#define RX_INIT_LATENCY 64 -#define RX_INIT_EARLY_THRESH 64 -#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */ -#define MIN_RX_EARLY_THRESHL 4 - -#define EEPROMSIZE 0x40 -#define MAX_EEPROMBUSY 1000 -#define EP_LAST_TAG 0xd7 -#define EP_MAX_BOARDS 16 -#define EP_ID_PORT 0x100 - -/* - * some macros to acces long named fields - */ -#define IS_BASE (eth_base) -#define BASE (eth_base) - -/* - * Commands to read/write EEPROM trough EEPROM command register (Window 0, - * Offset 0xa) - */ -#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */ -#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */ -#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */ -#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */ - -#define EEPROM_BUSY (1<<15) -#define EEPROM_TST_MODE (1<<14) - -/* - * Some short functions, worth to let them be a macro - */ -#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY) -#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|(x)) - -/************************************************************************** - * * - * These define the EEPROM data structure. They are used in the probe - * function to verify the existance of the adapter after having sent - * the ID_Sequence. - * - * There are others but only the ones we use are defined here. - * - **************************************************************************/ - -#define EEPROM_NODE_ADDR_0 0x0 /* Word */ -#define EEPROM_NODE_ADDR_1 0x1 /* Word */ -#define EEPROM_NODE_ADDR_2 0x2 /* Word */ -#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */ -#define EEPROM_MFG_ID 0x7 /* 0x6d50 */ -#define EEPROM_ADDR_CFG 0x8 /* Base addr */ -#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */ - -/************************************************************************** - * * - * These are the registers for the 3Com 3c509 and their bit patterns when * - * applicable. They have been taken out the the "EtherLink III Parallel * - * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual * - * from 3com. * - * * - **************************************************************************/ - -#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a - * command reg. */ -#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status - * reg. */ -#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window - * reg. */ -/* - * Window 0 registers. Setup. - */ -/* Write */ -#define EP_W0_EEPROM_DATA 0x0c -#define EP_W0_EEPROM_COMMAND 0x0a -#define EP_W0_RESOURCE_CFG 0x08 -#define EP_W0_ADDRESS_CFG 0x06 -#define EP_W0_CONFIG_CTRL 0x04 -/* Read */ -#define EP_W0_PRODUCT_ID 0x02 -#define EP_W0_MFG_ID 0x00 - -/* - * Window 1 registers. Operating Set. - */ -/* Write */ -#define EP_W1_TX_PIO_WR_2 0x02 -#define EP_W1_TX_PIO_WR_1 0x00 -/* Read */ -#define EP_W1_FREE_TX 0x0c -#define EP_W1_TX_STATUS 0x0b /* byte */ -#define EP_W1_TIMER 0x0a /* byte */ -#define EP_W1_RX_STATUS 0x08 -#define EP_W1_RX_PIO_RD_2 0x02 -#define EP_W1_RX_PIO_RD_1 0x00 - -/* - * Window 2 registers. Station Address Setup/Read - */ -/* Read/Write */ -#define EP_W2_ADDR_5 0x05 -#define EP_W2_ADDR_4 0x04 -#define EP_W2_ADDR_3 0x03 -#define EP_W2_ADDR_2 0x02 -#define EP_W2_ADDR_1 0x01 -#define EP_W2_ADDR_0 0x00 - -/* - * Window 3 registers. FIFO Management. - */ -/* Read */ -#define EP_W3_FREE_TX 0x0c -#define EP_W3_FREE_RX 0x0a - -/* - * Window 4 registers. Diagnostics. - */ -/* Read/Write */ -#define EP_W4_MEDIA_TYPE 0x0a -#define EP_W4_CTRLR_STATUS 0x08 -#define EP_W4_NET_DIAG 0x06 -#define EP_W4_FIFO_DIAG 0x04 -#define EP_W4_HOST_DIAG 0x02 -#define EP_W4_TX_DIAG 0x00 - -/* - * Window 5 Registers. Results and Internal status. - */ -/* Read */ -#define EP_W5_READ_0_MASK 0x0c -#define EP_W5_INTR_MASK 0x0a -#define EP_W5_RX_FILTER 0x08 -#define EP_W5_RX_EARLY_THRESH 0x06 -#define EP_W5_TX_AVAIL_THRESH 0x02 -#define EP_W5_TX_START_THRESH 0x00 - -/* - * Window 6 registers. Statistics. - */ -/* Read/Write */ -#define TX_TOTAL_OK 0x0c -#define RX_TOTAL_OK 0x0a -#define TX_DEFERRALS 0x08 -#define RX_FRAMES_OK 0x07 -#define TX_FRAMES_OK 0x06 -#define RX_OVERRUNS 0x05 -#define TX_COLLISIONS 0x04 -#define TX_AFTER_1_COLLISION 0x03 -#define TX_AFTER_X_COLLISIONS 0x02 -#define TX_NO_SQE 0x01 -#define TX_CD_LOST 0x00 - -/**************************************** - * - * Register definitions. - * - ****************************************/ - -/* - * Command register. All windows. - * - * 16 bit register. - * 15-11: 5-bit code for command to be executed. - * 10-0: 11-bit arg if any. For commands with no args; - * this can be set to anything. - */ -#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms - * after issuing */ -#define WINDOW_SELECT (u_short) (0x1<<11) -#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to - * determine whether - * this is needed. If - * so; wait 800 uSec - * before using trans- - * ceiver. */ -#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on - * power-up */ -#define RX_ENABLE (u_short) (0x4<<11) -#define RX_RESET (u_short) (0x5<<11) -#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11) -#define TX_ENABLE (u_short) (0x9<<11) -#define TX_DISABLE (u_short) (0xa<<11) -#define TX_RESET (u_short) (0xb<<11) -#define REQ_INTR (u_short) (0xc<<11) -#define SET_INTR_MASK (u_short) (0xe<<11) -#define SET_RD_0_MASK (u_short) (0xf<<11) -#define SET_RX_FILTER (u_short) (0x10<<11) -#define FIL_INDIVIDUAL (u_short) (0x1) -#define FIL_GROUP (u_short) (0x2) -#define FIL_BRDCST (u_short) (0x4) -#define FIL_ALL (u_short) (0x8) -#define SET_RX_EARLY_THRESH (u_short) (0x11<<11) -#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11) -#define SET_TX_START_THRESH (u_short) (0x13<<11) -#define STATS_ENABLE (u_short) (0x15<<11) -#define STATS_DISABLE (u_short) (0x16<<11) -#define STOP_TRANSCEIVER (u_short) (0x17<<11) -/* - * The following C_* acknowledge the various interrupts. Some of them don't - * do anything. See the manual. - */ -#define ACK_INTR (u_short) (0x6800) -#define C_INTR_LATCH (u_short) (ACK_INTR|0x1) -#define C_CARD_FAILURE (u_short) (ACK_INTR|0x2) -#define C_TX_COMPLETE (u_short) (ACK_INTR|0x4) -#define C_TX_AVAIL (u_short) (ACK_INTR|0x8) -#define C_RX_COMPLETE (u_short) (ACK_INTR|0x10) -#define C_RX_EARLY (u_short) (ACK_INTR|0x20) -#define C_INT_RQD (u_short) (ACK_INTR|0x40) -#define C_UPD_STATS (u_short) (ACK_INTR|0x80) - -/* - * Status register. All windows. - * - * 15-13: Window number(0-7). - * 12: Command_in_progress. - * 11: reserved. - * 10: reserved. - * 9: reserved. - * 8: reserved. - * 7: Update Statistics. - * 6: Interrupt Requested. - * 5: RX Early. - * 4: RX Complete. - * 3: TX Available. - * 2: TX Complete. - * 1: Adapter Failure. - * 0: Interrupt Latch. - */ -#define S_INTR_LATCH (u_short) (0x1) -#define S_CARD_FAILURE (u_short) (0x2) -#define S_TX_COMPLETE (u_short) (0x4) -#define S_TX_AVAIL (u_short) (0x8) -#define S_RX_COMPLETE (u_short) (0x10) -#define S_RX_EARLY (u_short) (0x20) -#define S_INT_RQD (u_short) (0x40) -#define S_UPD_STATS (u_short) (0x80) -#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\ - S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) -#define S_COMMAND_IN_PROGRESS (u_short) (0x1000) - -/* - * FIFO Registers. - * RX Status. Window 1/Port 08 - * - * 15: Incomplete or FIFO empty. - * 14: 1: Error in RX Packet 0: Incomplete or no error. - * 13-11: Type of error. - * 1000 = Overrun. - * 1011 = Run Packet Error. - * 1100 = Alignment Error. - * 1101 = CRC Error. - * 1001 = Oversize Packet Error (>1514 bytes) - * 0010 = Dribble Bits. - * (all other error codes, no errors.) - * - * 10-0: RX Bytes (0-1514) - */ -#define ERR_RX_INCOMPLETE (u_short) (0x1<<15) -#define ERR_RX (u_short) (0x1<<14) -#define ERR_RX_OVERRUN (u_short) (0x8<<11) -#define ERR_RX_RUN_PKT (u_short) (0xb<<11) -#define ERR_RX_ALIGN (u_short) (0xc<<11) -#define ERR_RX_CRC (u_short) (0xd<<11) -#define ERR_RX_OVERSIZE (u_short) (0x9<<11) -#define ERR_RX_DRIBBLE (u_short) (0x2<<11) - -/* - * FIFO Registers. - * TX Status. Window 1/Port 0B - * - * Reports the transmit status of a completed transmission. Writing this - * register pops the transmit completion stack. - * - * Window 1/Port 0x0b. - * - * 7: Complete - * 6: Interrupt on successful transmission requested. - * 5: Jabber Error (TP Only, TX Reset required. ) - * 4: Underrun (TX Reset required. ) - * 3: Maximum Collisions. - * 2: TX Status Overflow. - * 1-0: Undefined. - * - */ -#define TXS_COMPLETE 0x80 -#define TXS_SUCCES_INTR_REQ 0x40 -#define TXS_JABBER 0x20 -#define TXS_UNDERRUN 0x10 -#define TXS_MAX_COLLISION 0x8 -#define TXS_STATUS_OVERFLOW 0x4 - -/* - * Configuration control register. - * Window 0/Port 04 - */ -/* Read */ -#define IS_AUI (1<<13) -#define IS_BNC (1<<12) -#define IS_UTP (1<<9) -/* Write */ -#define ENABLE_DRQ_IRQ 0x0001 -#define W0_P4_CMD_RESET_ADAPTER 0x4 -#define W0_P4_CMD_ENABLE_ADAPTER 0x1 -/* - * Media type and status. - * Window 4/Port 0A - */ -#define ENABLE_UTP 0xc0 -#define DISABLE_UTP 0x0 - -/* - * Resource control register - */ - -#define SET_IRQ(i) ( ((i)<<12) | 0xF00) /* set IRQ i */ - -/* - * Receive status register - */ - -#define RX_BYTES_MASK (u_short) (0x07ff) -#define RX_ERROR 0x4000 -#define RX_INCOMPLETE 0x8000 - - -/* - * Misc defines for various things. - */ -#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */ -#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */ -#define PROD_ID 0x9150 - -#define AUI 0x1 -#define BNC 0x2 -#define UTP 0x4 - -#define ETHER_ADDR_LEN 6 -#define ETHER_MAX 1536 -#define RX_BYTES_MASK (u_short) (0x07ff) - - /* EISA support */ -#define EP_EISA_START 0x1000 -#define EP_EISA_W0 0x0c80 diff --git a/sys/pc98/boot/netboot/Makefile b/sys/pc98/boot/netboot/Makefile deleted file mode 100644 index dad72fc3b15d..000000000000 --- a/sys/pc98/boot/netboot/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -# Makefile,v 1.4 1994/12/31 17:16:49 jkh Exp -# -# Makefile for NETBOOT -# -# Basic Options: -# -DSECURE_BOOT - Disable 'boot>' prompt completely -# -DASK_BOOT - Ask "Boot from Network (Y/N) ?" at startup -# -DROMSIZE - Size of EPROM - Must be set (even for .COM files) -# -DRELOC - Relocation address (usually 0x90000) -# -# NS8390 Options: -# -DINCLUDE_WD - Include Western Digital/SMC support -# -DINCLUDE_NE - Include NE1000/NE2000 support -# -DINCLUDE_3COM - Include 3c503 support -# -D_3COM_USE_AUI - Disable transceiver on 3c503 by default -# -DNE_BASE - Base I/O address for NE1000/NE2000 -# -D_3COM_BASE - Base I/O address for 3c503 -# -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards -# -DINCLUDE_EGY - Include MELCO EGY support -# -DINCLUDE_LGY - Include MELCO LGY support -# -DINCLUDE_ICM - Include IF-2766 support -# -DINCLUDE_SIC - Include SIC supoort -# -DED_BASE - Base I/O address for NE1000/NE2000 -# -DSIC_DEFAULT_MEM- Default memory location for WD/SMC cards -# XXX nothing depends on this Makefile so you must run `make clean' after -# changing an option. -# - -### options for PCI cards -### -#PCI_VENDOR=0x10ec -#PCI_DEVICE=0x8029 -#PCI_CLASS=0x02,0x00,0x00 - -PROG= nb8390.com nb8390.rom -# Order is very important on the SRCS line for this prog -SRCS= start2.S main.c misc.c bootmenu.c rpc.c - -BINMODE= 555 -CFLAGS= -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR} -DASK_BOOT -CFLAGS+= -DPC98 -#CFLAGS += -DPCI -DPCI_VENDOR=${PCI_VENDOR} -DPCI_DEVICE=${PCI_DEVICE} -#CFLAGS += -DPCI_CLASS=${PCI_CLASS} -DASK_BOOT -#NS8390= -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000 -#NS8390= -DINCLUDE_NE -#NS8390+= -DINCLUDE_3COM -D_3COM_BASE=0x300 -NS8390= -DINCLUDE_EGY -DNE_BASE=0xd0 -CLEANFILES+= netboot.com -CLEANFILES+= makerom start2.ro 3c509.o ns8390.o -ROMLDFLAGS= ${LDFLAGS} -aout -N -T ${RELOCADDR} -e _start -nostdlib -NOSHARED= YES -NOMAN= -SIZE= size -aout -STRIP= -STRIPCMD= strip -aout - -ROMSIZE=16384 -RELOCADDR=0x90000 - -.SUFFIXES: .ro - -.S.ro: - ${CC} ${CFLAGS} -DBOOTROM -o ${.TARGET} -c ${.IMPSRC} - -build-tools: makerom - -ns8390.o: ns8390.c - ${CC} ${CFLAGS} $(NS8390) -o ${.TARGET} -c $< - -makerom: makerom.c - ${CC} ${CFLAGS} -DROMSIZE=${ROMSIZE} ${LDFLAGS} -o ${.TARGET} \ - ${.CURDIR}/makerom.c - -nb8390.rom: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} ns8390.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET} ${OBJS:S/start2.o/start2.ro/} ns8390.o - ${STRIPCMD} ${.TARGET} - ${SIZE} ${.TARGET} - ${.OBJDIR}/makerom ${.TARGET} - -nb3c509.rom: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} 3c509.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET} ${OBJS:S/start2.o/start2.ro/} 3c509.o - ${STRIPCMD} ${.TARGET} - ${SIZE} ${.TARGET} - ${.OBJDIR}/makerom ${.TARGET} - -nb8390.com: makerom start2.ro ${SRCS:N*.h:R:S/$/.o/g} ns8390.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET}.tmp ${OBJS} ns8390.o - ${STRIPCMD} ${.TARGET}.tmp - ${SIZE} ${.TARGET}.tmp - dd ibs=32 skip=1 if=${.TARGET}.tmp of=${.TARGET} - rm -f ${.TARGET}.tmp - -nb3c509.com: start2.o ${SRCS:N*.h:R:S/$/.o/g} 3c509.o - ${LD} ${ROMLDFLAGS} -o ${.TARGET}.tmp ${OBJS} 3c509.o - ${STRIPCMD} ${.TARGET}.tmp - ${SIZE} ${.TARGET}.tmp - dd ibs=32 skip=1 if=${.TARGET}.tmp of=${.TARGET} - rm -f ${.TARGET}.tmp - -# This force the creation of the "machine" symlink. These objects are -# specially handled in this file, and thus can't be taken care of in -# ../Makefile.inc -3c509.o makerom ns8390.o start2.ro: machine - -.include <bsd.prog.mk> diff --git a/sys/pc98/boot/netboot/bootmenu.c b/sys/pc98/boot/netboot/bootmenu.c deleted file mode 100644 index 4ec2106bdf00..000000000000 --- a/sys/pc98/boot/netboot/bootmenu.c +++ /dev/null @@ -1,377 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ -#include "netboot.h" - -extern struct nfs_diskless nfsdiskless; -extern int hostnamelen; -extern unsigned long netmask; -extern eth_reset(); -extern short aui; -extern int howto; - -int cmd_ip(), cmd_server(), cmd_kernel(), cmd_help(), exit(); -int cmd_rootfs(), cmd_swapfs(), cmd_interface(), cmd_hostname(); -int cmd_netmask(), cmd_swapsize(), cmd_swapopts(), cmd_rootopts(); -int cmd_aui(), cmd_gateway(), cmd_flags(); - -struct bootcmds_t { - char *name; - int (*func)(); - char *help; -} bootcmds[] = { - {"?", cmd_help, " this list"}, - {"help", cmd_help, " this list"}, - {"ip", cmd_ip, "<addr> set my IP addr"}, - {"server", cmd_server, "<addr> set TFTP server IP addr"}, - {"gateway", cmd_gateway, "<addr> set default router"}, - {"netmask", cmd_netmask, "<addr> set network mask"}, - {"hostname", cmd_hostname, "<name> set hostname"}, - {"kernel", cmd_kernel, "<file> set boot filename"}, - {"rootfs", cmd_rootfs, "[ip:]/fs set root filesystem"}, - {"swapfs", cmd_swapfs, "[ip:]/fs set swap filesystem"}, - {"swapsize", cmd_swapsize, "<nblks> set swap size"}, - {"swapopts", cmd_swapopts, "<options> swap mount options"}, - {"rootopts", cmd_rootopts, "<options> root mount options"}, - {"diskboot", exit, " boot from disk"}, - {"autoboot", NULL, " continue"}, - {"trans", cmd_aui, "<on|off> turn transceiver on|off"}, - {"flags", cmd_flags, "[bcdghsv] set boot flags"}, - {NULL, NULL, NULL} -}; - -/************************************************************************** -CMD_HELP - Display help screen -**************************************************************************/ -cmd_help() -{ - struct bootcmds_t *cmd = bootcmds; - printf("\n"); - while (cmd->name) { - printf("%s %s\n",cmd->name,cmd->help); - cmd++; - } -} - -/************************************************************************** -CMD_IP - Set my IP address -**************************************************************************/ -cmd_ip(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_CLIENT].ipaddr)) { - printf("IP address is %I\n", - arptable[ARP_CLIENT].ipaddr); - } else default_netmask(); -} - -/************************************************************************** -CMD_AUI - Turn on-board transceiver on or off -**************************************************************************/ -cmd_aui(p) - char *p; -{ - if (*(p+1) == 'f') { - aui = 1; - eth_reset(); - return(0); - } - if (*(p+1) == 'n') { - aui = 0; - eth_reset(); - return(0); - } - printf ("Transceiver is %s\n",aui ? "off" : "on"); -} - -/************************************************************************** -CMD_GATEWAY - Set routers IP address -**************************************************************************/ -cmd_gateway(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_GATEWAY].ipaddr)) { - printf("Server IP address is %I\n", - arptable[ARP_GATEWAY].ipaddr); - } else /* Need to clear arp entry if we change IP address */ - for (i=0; i<6; i++) arptable[ARP_GATEWAY].node[i] = 0; -} - -/************************************************************************** -CMD_SERVER - Set server's IP address -**************************************************************************/ -cmd_server(p) - char *p; -{ - int i; - if (!setip(p, &arptable[ARP_SERVER].ipaddr)) { - printf("Server IP address is %I\n", - arptable[ARP_SERVER].ipaddr); - } else /* Need to clear arp entry if we change IP address */ - for (i=0; i<6; i++) arptable[ARP_SERVER].node[i] = 0; -} - -/************************************************************************** -CMD_NETMASK - Set network mask -**************************************************************************/ -cmd_netmask(p) - char *p; -{ - int i; - if (!setip(p, &netmask)) { - netmask = ntohl(netmask); - printf("netmask is %I\n", netmask); - } - netmask = htonl(netmask); -} - -/************************************************************************** -CMD_SWAPSIZE - Set number of blocks for swap -**************************************************************************/ -cmd_swapsize(p) - char *p; -{ - int blks = getdec(&p); - if (blks > 0) nfsdiskless.swap_nblks = blks; - else printf("Swap size is: %d blocks\n",nfsdiskless.swap_nblks); -} - -extern char kernel_buf[], *kernel; -/************************************************************************** -CMD_KERNEL - set kernel filename -**************************************************************************/ -cmd_kernel(p) - char *p; -{ - if (*p) sprintf(kernel = kernel_buf,"%s",p); - printf("Bootfile is: %s\n", kernel); -} - - -/************************************************************************** -CMD_ROOTFS - Set root filesystem name -**************************************************************************/ -cmd_rootfs(p) - char *p; -{ - if (*p == '/') { - bcopy(&arptable[ARP_SERVER].ipaddr, - &arptable[ARP_ROOTSERVER].ipaddr, 4); - } else if (!setip(p, &arptable[ARP_ROOTSERVER].ipaddr)) { - printf("Root filesystem is %I:%s\r\n", - nfsdiskless.root_saddr.sin_addr, - nfsdiskless.root_hostnam); - return; - } else { - while (*p && (*p != ':')) p++; - if (*p == ':') p++; - } - - bcopy(&arptable[ARP_ROOTSERVER].ipaddr, - &nfsdiskless.root_saddr.sin_addr, 4); - sprintf(&nfsdiskless.root_hostnam, "%s", p); -} - -/************************************************************************** -CMD_SWAPFS - Set swap filesystem name -**************************************************************************/ -cmd_swapfs(p) - char *p; -{ - if (*p == '/') { - bcopy(&arptable[ARP_SERVER].ipaddr, - &arptable[ARP_SWAPSERVER].ipaddr, 4); - } else if (!setip(p, &arptable[ARP_SWAPSERVER].ipaddr)) { - printf("Swap filesystem is %I:%s\n", - nfsdiskless.swap_saddr.sin_addr, - nfsdiskless.swap_hostnam); - return; - } else { - while (*p && (*p != ':')) p++; - if (*p == ':') p++; - } - - bcopy(&arptable[ARP_SWAPSERVER].ipaddr, - &nfsdiskless.swap_saddr.sin_addr, 4); - sprintf(&nfsdiskless.swap_hostnam, "%s", p); -} - -/************************************************************************** -CMD_HOSTNAME - Set my hostname -**************************************************************************/ -cmd_hostname(p) - char *p; -{ - if (*p) - hostnamelen = ((sprintf(&nfsdiskless.my_hostnam,"%s",p) - - (char*)&nfsdiskless.my_hostnam) + 3) & ~3; - else printf("Hostname is: %s\n",nfsdiskless.my_hostnam); -} - -static void mountopts(prefix,args,p) - char *prefix; - struct onfs_args *args; - char *p; -{ - char *tmp; - - if (*p) { - args->flags = NFSMNT_RSIZE | NFSMNT_WSIZE | NFSMNT_RESVPORT; - args->sotype = SOCK_DGRAM; - if ((tmp = (char *)substr(p,"rsize="))) - args->rsize=getdec(&tmp); - if ((tmp = (char *)substr(p,"wsize="))) - args->wsize=getdec(&tmp); - if ((tmp = (char *)substr(p,"intr"))) - args->flags |= NFSMNT_INT; - if ((tmp = (char *)substr(p,"soft"))) - args->flags |= NFSMNT_SOFT; - if ((tmp = (char *)substr(p,"noconn"))) - args->flags |= NFSMNT_NOCONN; - if ((tmp = (char *)substr(p, "tcp"))) - args->sotype = SOCK_STREAM; - } else { - printf("%s mount options: rsize=%d,wsize=%d,resvport", - prefix, - args->rsize, - args->wsize); - if (args->flags & NFSMNT_INT) - printf (",intr"); - if (args->flags & NFSMNT_SOFT) - printf (",soft"); - if (args->flags & NFSMNT_NOCONN) - printf (",noconn"); - if (args->sotype == SOCK_STREAM) - printf (",tcp"); - else - printf (",udp"); - printf ("\n"); - } -} - -/************************************************************************** -CMD_ROOTOPTS - Set root mount options -**************************************************************************/ -cmd_rootopts(p) - char *p; -{ - mountopts("Rootfs",&nfsdiskless.root_args,p); -} - -/************************************************************************** -CMD_SWAPOPTS - Set swap mount options -**************************************************************************/ -cmd_swapopts(p) - char *p; -{ - mountopts("Swapfs",&nfsdiskless.swap_args,p); -} - -/************************************************************************** -CMD_FLAGS - Set boot flags -**************************************************************************/ -cmd_flags(buf) - char *buf; -{ - char p; - int flags = 0; - - while ((p = *buf++)) - switch (p) { - case 'b': flags |= RB_HALT; break; - case 'c': flags |= RB_CONFIG; break; - case 'd': flags |= RB_KDB; break; - case 'g': flags |= RB_GDB; break; - case 'h': flags ^= RB_SERIAL; break; - case 's': flags |= RB_SINGLE; break; - case 'v': flags |= RB_VERBOSE; break; - case ' ': - case '\t': break; - default: printf("Unknown boot flag: %c\n", p); - } - - howto = flags; - return(0); -} - -/************************************************************************** -EXECUTE - Decode command -**************************************************************************/ -execute(buf) - char *buf; -{ - char *p, *q; - struct bootcmds_t *cmd = bootcmds; - while (*buf == ' ' || *buf == '\t') - buf++; - if ((!(*buf)) || (*buf == '#')) - return(0); - while(cmd->name) { - p = buf; - q = cmd->name; - while (*q && *q == *p++) - q++; - if ((!(*q)) && ((*p == ' ') || (*p == '\t') || (!(*p)))) { - if (!cmd->func) - return(1); - while (*p == ' ' || *p == '\t') - p++; - (cmd->func)(p); - return(0); - } else - cmd++; - } - printf("bad command - type 'help' for list\n"); - return(0); -} - -/************************************************************************** -BOOTMENU - Present boot options -**************************************************************************/ -bootmenu() -{ - char cmd[80]; - int ptr, c; -#ifdef SECURE_BOOT - char *p; - - printf("\n"); - - printf("Press any key to retry:"); - while (iskey()) - getchar(); - getchar(); - printf("\n"); - eth_probe(); -#else - printf("\n"); - while (1) { - ptr = 0; - printf("boot> "); - while (ptr < 80) { - c = getchar(); - if (c == '\r') - break; - else if (c == '\b') { - if (ptr > 0) { - ptr--; - printf("\b \b"); - } - } else { - cmd[ptr++] = c; - putchar(c); - } - } - cmd[ptr] = 0; - printf("\n"); - if (execute(cmd)) break; - } -#endif - eth_reset(); -} diff --git a/sys/pc98/boot/netboot/if_epreg.h b/sys/pc98/boot/netboot/if_epreg.h deleted file mode 100644 index 049f235bbc5b..000000000000 --- a/sys/pc98/boot/netboot/if_epreg.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. 2. The name - * of the author may not be used to endorse or promote products derived from - * this software withough specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * if_epreg.h,v 1.4 1994/11/13 10:12:37 gibbs Exp Modified by: - * - October 2, 1994 - - Modified by: Andres Vega Garcia - - INRIA - Sophia Antipolis, France - e-mail: avega@sophia.inria.fr - finger: avega@pax.inria.fr - - */ - -/* - * Ethernet software status per interface. - */ -/* - * Some global constants - */ -#define ETHER_MIN_LEN 64 -#define ETHER_MAX_LEN 1518 -#define ETHER_ADDR_LEN 6 - -#define TX_INIT_RATE 16 -#define TX_INIT_MAX_RATE 64 -#define RX_INIT_LATENCY 64 -#define RX_INIT_EARLY_THRESH 64 -#define MIN_RX_EARLY_THRESHF 16 /* not less than ether_header */ -#define MIN_RX_EARLY_THRESHL 4 - -#define EEPROMSIZE 0x40 -#define MAX_EEPROMBUSY 1000 -#define EP_LAST_TAG 0xd7 -#define EP_MAX_BOARDS 16 -#define EP_ID_PORT 0x100 - -/* - * some macros to acces long named fields - */ -#define IS_BASE (eth_base) -#define BASE (eth_base) - -/* - * Commands to read/write EEPROM trough EEPROM command register (Window 0, - * Offset 0xa) - */ -#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */ -#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */ -#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */ -#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */ - -#define EEPROM_BUSY (1<<15) -#define EEPROM_TST_MODE (1<<14) - -/* - * Some short functions, worth to let them be a macro - */ -#define is_eeprom_busy(b) (inw((b)+EP_W0_EEPROM_COMMAND)&EEPROM_BUSY) -#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|(x)) - -/************************************************************************** - * * - * These define the EEPROM data structure. They are used in the probe - * function to verify the existance of the adapter after having sent - * the ID_Sequence. - * - * There are others but only the ones we use are defined here. - * - **************************************************************************/ - -#define EEPROM_NODE_ADDR_0 0x0 /* Word */ -#define EEPROM_NODE_ADDR_1 0x1 /* Word */ -#define EEPROM_NODE_ADDR_2 0x2 /* Word */ -#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */ -#define EEPROM_MFG_ID 0x7 /* 0x6d50 */ -#define EEPROM_ADDR_CFG 0x8 /* Base addr */ -#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */ - -/************************************************************************** - * * - * These are the registers for the 3Com 3c509 and their bit patterns when * - * applicable. They have been taken out the the "EtherLink III Parallel * - * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual * - * from 3com. * - * * - **************************************************************************/ - -#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a - * command reg. */ -#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status - * reg. */ -#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window - * reg. */ -/* - * Window 0 registers. Setup. - */ -/* Write */ -#define EP_W0_EEPROM_DATA 0x0c -#define EP_W0_EEPROM_COMMAND 0x0a -#define EP_W0_RESOURCE_CFG 0x08 -#define EP_W0_ADDRESS_CFG 0x06 -#define EP_W0_CONFIG_CTRL 0x04 -/* Read */ -#define EP_W0_PRODUCT_ID 0x02 -#define EP_W0_MFG_ID 0x00 - -/* - * Window 1 registers. Operating Set. - */ -/* Write */ -#define EP_W1_TX_PIO_WR_2 0x02 -#define EP_W1_TX_PIO_WR_1 0x00 -/* Read */ -#define EP_W1_FREE_TX 0x0c -#define EP_W1_TX_STATUS 0x0b /* byte */ -#define EP_W1_TIMER 0x0a /* byte */ -#define EP_W1_RX_STATUS 0x08 -#define EP_W1_RX_PIO_RD_2 0x02 -#define EP_W1_RX_PIO_RD_1 0x00 - -/* - * Window 2 registers. Station Address Setup/Read - */ -/* Read/Write */ -#define EP_W2_ADDR_5 0x05 -#define EP_W2_ADDR_4 0x04 -#define EP_W2_ADDR_3 0x03 -#define EP_W2_ADDR_2 0x02 -#define EP_W2_ADDR_1 0x01 -#define EP_W2_ADDR_0 0x00 - -/* - * Window 3 registers. FIFO Management. - */ -/* Read */ -#define EP_W3_FREE_TX 0x0c -#define EP_W3_FREE_RX 0x0a - -/* - * Window 4 registers. Diagnostics. - */ -/* Read/Write */ -#define EP_W4_MEDIA_TYPE 0x0a -#define EP_W4_CTRLR_STATUS 0x08 -#define EP_W4_NET_DIAG 0x06 -#define EP_W4_FIFO_DIAG 0x04 -#define EP_W4_HOST_DIAG 0x02 -#define EP_W4_TX_DIAG 0x00 - -/* - * Window 5 Registers. Results and Internal status. - */ -/* Read */ -#define EP_W5_READ_0_MASK 0x0c -#define EP_W5_INTR_MASK 0x0a -#define EP_W5_RX_FILTER 0x08 -#define EP_W5_RX_EARLY_THRESH 0x06 -#define EP_W5_TX_AVAIL_THRESH 0x02 -#define EP_W5_TX_START_THRESH 0x00 - -/* - * Window 6 registers. Statistics. - */ -/* Read/Write */ -#define TX_TOTAL_OK 0x0c -#define RX_TOTAL_OK 0x0a -#define TX_DEFERRALS 0x08 -#define RX_FRAMES_OK 0x07 -#define TX_FRAMES_OK 0x06 -#define RX_OVERRUNS 0x05 -#define TX_COLLISIONS 0x04 -#define TX_AFTER_1_COLLISION 0x03 -#define TX_AFTER_X_COLLISIONS 0x02 -#define TX_NO_SQE 0x01 -#define TX_CD_LOST 0x00 - -/**************************************** - * - * Register definitions. - * - ****************************************/ - -/* - * Command register. All windows. - * - * 16 bit register. - * 15-11: 5-bit code for command to be executed. - * 10-0: 11-bit arg if any. For commands with no args; - * this can be set to anything. - */ -#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms - * after issuing */ -#define WINDOW_SELECT (u_short) (0x1<<11) -#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to - * determine whether - * this is needed. If - * so; wait 800 uSec - * before using trans- - * ceiver. */ -#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on - * power-up */ -#define RX_ENABLE (u_short) (0x4<<11) -#define RX_RESET (u_short) (0x5<<11) -#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11) -#define TX_ENABLE (u_short) (0x9<<11) -#define TX_DISABLE (u_short) (0xa<<11) -#define TX_RESET (u_short) (0xb<<11) -#define REQ_INTR (u_short) (0xc<<11) -#define SET_INTR_MASK (u_short) (0xe<<11) -#define SET_RD_0_MASK (u_short) (0xf<<11) -#define SET_RX_FILTER (u_short) (0x10<<11) -#define FIL_INDIVIDUAL (u_short) (0x1) -#define FIL_GROUP (u_short) (0x2) -#define FIL_BRDCST (u_short) (0x4) -#define FIL_ALL (u_short) (0x8) -#define SET_RX_EARLY_THRESH (u_short) (0x11<<11) -#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11) -#define SET_TX_START_THRESH (u_short) (0x13<<11) -#define STATS_ENABLE (u_short) (0x15<<11) -#define STATS_DISABLE (u_short) (0x16<<11) -#define STOP_TRANSCEIVER (u_short) (0x17<<11) -/* - * The following C_* acknowledge the various interrupts. Some of them don't - * do anything. See the manual. - */ -#define ACK_INTR (u_short) (0x6800) -#define C_INTR_LATCH (u_short) (ACK_INTR|0x1) -#define C_CARD_FAILURE (u_short) (ACK_INTR|0x2) -#define C_TX_COMPLETE (u_short) (ACK_INTR|0x4) -#define C_TX_AVAIL (u_short) (ACK_INTR|0x8) -#define C_RX_COMPLETE (u_short) (ACK_INTR|0x10) -#define C_RX_EARLY (u_short) (ACK_INTR|0x20) -#define C_INT_RQD (u_short) (ACK_INTR|0x40) -#define C_UPD_STATS (u_short) (ACK_INTR|0x80) - -/* - * Status register. All windows. - * - * 15-13: Window number(0-7). - * 12: Command_in_progress. - * 11: reserved. - * 10: reserved. - * 9: reserved. - * 8: reserved. - * 7: Update Statistics. - * 6: Interrupt Requested. - * 5: RX Early. - * 4: RX Complete. - * 3: TX Available. - * 2: TX Complete. - * 1: Adapter Failure. - * 0: Interrupt Latch. - */ -#define S_INTR_LATCH (u_short) (0x1) -#define S_CARD_FAILURE (u_short) (0x2) -#define S_TX_COMPLETE (u_short) (0x4) -#define S_TX_AVAIL (u_short) (0x8) -#define S_RX_COMPLETE (u_short) (0x10) -#define S_RX_EARLY (u_short) (0x20) -#define S_INT_RQD (u_short) (0x40) -#define S_UPD_STATS (u_short) (0x80) -#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\ - S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) -#define S_COMMAND_IN_PROGRESS (u_short) (0x1000) - -/* - * FIFO Registers. - * RX Status. Window 1/Port 08 - * - * 15: Incomplete or FIFO empty. - * 14: 1: Error in RX Packet 0: Incomplete or no error. - * 13-11: Type of error. - * 1000 = Overrun. - * 1011 = Run Packet Error. - * 1100 = Alignment Error. - * 1101 = CRC Error. - * 1001 = Oversize Packet Error (>1514 bytes) - * 0010 = Dribble Bits. - * (all other error codes, no errors.) - * - * 10-0: RX Bytes (0-1514) - */ -#define ERR_RX_INCOMPLETE (u_short) (0x1<<15) -#define ERR_RX (u_short) (0x1<<14) -#define ERR_RX_OVERRUN (u_short) (0x8<<11) -#define ERR_RX_RUN_PKT (u_short) (0xb<<11) -#define ERR_RX_ALIGN (u_short) (0xc<<11) -#define ERR_RX_CRC (u_short) (0xd<<11) -#define ERR_RX_OVERSIZE (u_short) (0x9<<11) -#define ERR_RX_DRIBBLE (u_short) (0x2<<11) - -/* - * FIFO Registers. - * TX Status. Window 1/Port 0B - * - * Reports the transmit status of a completed transmission. Writing this - * register pops the transmit completion stack. - * - * Window 1/Port 0x0b. - * - * 7: Complete - * 6: Interrupt on successful transmission requested. - * 5: Jabber Error (TP Only, TX Reset required. ) - * 4: Underrun (TX Reset required. ) - * 3: Maximum Collisions. - * 2: TX Status Overflow. - * 1-0: Undefined. - * - */ -#define TXS_COMPLETE 0x80 -#define TXS_SUCCES_INTR_REQ 0x40 -#define TXS_JABBER 0x20 -#define TXS_UNDERRUN 0x10 -#define TXS_MAX_COLLISION 0x8 -#define TXS_STATUS_OVERFLOW 0x4 - -/* - * Configuration control register. - * Window 0/Port 04 - */ -/* Read */ -#define IS_AUI (1<<13) -#define IS_BNC (1<<12) -#define IS_UTP (1<<9) -/* Write */ -#define ENABLE_DRQ_IRQ 0x0001 -#define W0_P4_CMD_RESET_ADAPTER 0x4 -#define W0_P4_CMD_ENABLE_ADAPTER 0x1 -/* - * Media type and status. - * Window 4/Port 0A - */ -#define ENABLE_UTP 0xc0 -#define DISABLE_UTP 0x0 - -/* - * Resource control register - */ - -#define SET_IRQ(i) ( ((i)<<12) | 0xF00) /* set IRQ i */ - -/* - * Receive status register - */ - -#define RX_BYTES_MASK (u_short) (0x07ff) -#define RX_ERROR 0x4000 -#define RX_INCOMPLETE 0x8000 - - -/* - * Misc defines for various things. - */ -#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */ -#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */ -#define PROD_ID 0x9150 - -#define AUI 0x1 -#define BNC 0x2 -#define UTP 0x4 - -#define ETHER_ADDR_LEN 6 -#define ETHER_MAX 1536 -#define RX_BYTES_MASK (u_short) (0x07ff) - - /* EISA support */ -#define EP_EISA_START 0x1000 -#define EP_EISA_W0 0x0c80 diff --git a/sys/pc98/boot/netboot/main.c b/sys/pc98/boot/netboot/main.c deleted file mode 100644 index 791cd85defe0..000000000000 --- a/sys/pc98/boot/netboot/main.c +++ /dev/null @@ -1,728 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ - -/* #define MDEBUG */ - -#include "netboot.h" - -int jmp_bootmenu[10]; - -struct exec head; -char *loadpoint; -char *kernel; -char kernel_buf[128]; -void (*kernelentry)(); -struct nfs_diskless nfsdiskless; -int hostnamelen; -char config_buffer[512]; /* Max TFTP packet */ -struct bootinfo bootinfo; -int root_nfs_port; -unsigned long netmask; -char kernel_handle[32]; -int offset, howto; - -extern char eth_driver[]; -extern char packet[]; -extern int packetlen, rpc_id; -char broadcast[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - -/************************************************************************** -MAIN - Kick off routine -**************************************************************************/ -main() -{ - int c; - extern char edata[], end[]; - bzero(edata,end-edata); /* Zero BSS */ -#ifdef ASK_BOOT - while (1) { - printf("\nBoot from Network (Y/N) ? "); - c = getchar(); - if ((c >= 'a') && (c <= 'z')) c &= 0x5F; - if (c == '\r') break; - putchar(c); - if (c == 'N') - exit(0); - if (c == 'Y') - break; - printf(" - bad response\n"); - } -#endif - - /* get the bios's idea about the disks geometry */ -#ifdef PC98 - for(c = 0; c < 2; c ++) { - if (*(unsigned char*)0xa155d & (1 << c)) { /* check DISK_EQUIP */ - bootinfo.bi_bios_geom[c] = get_diskinfo(c + 0x80); - } - } -#else /* IBM-PC */ - for(c = 0; c < N_BIOS_GEOM; c ++) - bootinfo.bi_bios_geom[c] = get_diskinfo(c + 0x80); -#endif /* PC98 */ - - gateA20(); -#ifdef PC98 - /* set machine type to PC98_SYSTEM_PARAMETER */ - machine_check(); -#endif - printf("\nBOOTP/TFTP/NFS bootstrap loader ESC for menu\n" - "\nSearching for adapter..."); - if (!eth_probe()) { - printf("No adapter found.\n"); - exit(0); - } - kernel = DEFAULT_BOOTFILE; - while (1) { - if (setjmp(jmp_bootmenu)) - bootmenu(); - else - load(); - } -} - -void -nfsload(length) -{ - int err, read_size; - - while (length > 0) { - read_size = length > NFS_READ_SIZE ? - NFS_READ_SIZE : length; - if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, - &kernel_handle, offset, read_size, loadpoint)) != - read_size) { - if (err < 0) { - printf("Unable to read data: "); - nfs_err(err); - } - longjmp(jmp_bootmenu, 1); - } - loadpoint += err; - length -= err; - offset += err; - } -} - -/************************************************************************** -LOAD - Try to get booted -**************************************************************************/ -load() -{ - char *p,*q; - char cfg[64]; - int root_mount_port; - int swap_nfs_port; - int swap_mount_port; - char cmd_line[80]; - int err, read_size, i; - long addr, broadcast; - int swsize; - unsigned long pad; - - config_buffer[0]='\0'; /* clear; bootp might fill this up */ -/* Initialize this early on */ - - nfsdiskless.root_args.rsize = 8192; - nfsdiskless.root_args.wsize = 8192; - nfsdiskless.swap_args.rsize = 8192; - nfsdiskless.swap_args.wsize = 8192; - nfsdiskless.root_args.sotype = SOCK_DGRAM; - nfsdiskless.root_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE | - NFSMNT_RESVPORT); - nfsdiskless.swap_args.sotype = SOCK_DGRAM; - nfsdiskless.swap_args.flags = (NFSMNT_WSIZE | NFSMNT_RSIZE | - NFSMNT_RESVPORT); - - - /* Find a server to get BOOTP reply from */ - if (!arptable[ARP_CLIENT].ipaddr || !arptable[ARP_SERVER].ipaddr) { - printf("\nSearching for server...\n"); - if (!bootp()) { - printf("No Server found.\n"); - longjmp(jmp_bootmenu,1); - } - } - printf("My IP %I, Server IP %I, GW IP %I\n", - arptable[ARP_CLIENT].ipaddr, - arptable[ARP_SERVER].ipaddr, - arptable[ARP_GATEWAY].ipaddr); - -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - /*** check if have got info from bootp ***/ - if (config_buffer[0]) - goto cfg_done; -#ifndef NO_TFTP - /* Now use TFTP to load configuration file */ - sprintf(cfg,"/tftpboot/freebsd.%I",arptable[ARP_CLIENT].ipaddr); - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; - cfg[17]='\0'; - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; - sprintf(cfg,"/tftpboot/cfg.%I",arptable[ARP_CLIENT].ipaddr); - if (tftp(cfg) || tftp(cfg+10)) - goto cfg_done; -#endif - /* not found; using default values... */ - sprintf(config_buffer,"rootfs %I:/usr/diskless_root", - arptable[ARP_SERVER].ipaddr); - printf("Unable to load config file, guessing:\n\t%s\n", - config_buffer); - -cfg_done: -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - p = config_buffer; - while(*p) { - q = cmd_line; - while ((*p != '\n') && (*p)) *(q++) = *(p++); - *q = 0; - printf("%s\n",cmd_line); - execute(cmd_line); - if (*p) p++; - } - -#ifdef MDEBUG - printf("\n=>>"); getchar(); -#endif - - /* Check to make sure we've got a rootfs */ - if (!arptable[ARP_ROOTSERVER].ipaddr) { - printf("No ROOT filesystem server!\n"); - longjmp(jmp_bootmenu,1); - } - - /* Fill in nfsdiskless.myif */ - sprintf(&nfsdiskless.myif.ifra_name,eth_driver); - nfsdiskless.myif.ifra_addr.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_addr.sa_family = AF_INET; - addr = htonl(arptable[ARP_CLIENT].ipaddr); - bcopy(&addr, &nfsdiskless.myif.ifra_addr.sa_data[2], 4); - broadcast = (addr & netmask) | ~netmask; - nfsdiskless.myif.ifra_broadaddr.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_broadaddr.sa_family = AF_INET; - bcopy(&broadcast, &nfsdiskless.myif.ifra_broadaddr.sa_data[2], 4); - addr = htonl(arptable[ARP_GATEWAY].ipaddr); - if (addr) { - nfsdiskless.mygateway.sin_len = sizeof(struct sockaddr); - nfsdiskless.mygateway.sin_family = AF_INET; - bcopy(&addr, &nfsdiskless.mygateway.sin_addr, 4); - } else { - nfsdiskless.mygateway.sin_len = 0; - } - nfsdiskless.myif.ifra_mask.sa_len = sizeof(struct sockaddr); - nfsdiskless.myif.ifra_mask.sa_family = AF_UNSPEC; - bcopy(&netmask, &nfsdiskless.myif.ifra_mask.sa_data[2], 4); - - rpc_id = currticks(); - - /* Lookup NFS/MOUNTD ports for SWAP using PORTMAP */ - if (arptable[ARP_SWAPSERVER].ipaddr) { - char swapfs_fh[32], swapfile[32]; - swap_nfs_port = rpclookup(ARP_SWAPSERVER, PROG_NFS, 2); - swap_mount_port = rpclookup(ARP_SWAPSERVER, PROG_MOUNT, 1); - if ((swap_nfs_port == -1) || (swap_mount_port == -1)) { - printf("Unable to get SWAP NFS/MOUNT ports\n"); - longjmp(jmp_bootmenu,1); - } - if (err = nfs_mount(ARP_SWAPSERVER, swap_mount_port, - nfsdiskless.swap_hostnam, &swapfs_fh)) { - printf("Unable to mount SWAP filesystem: "); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - sprintf(swapfile,"swap.%I",arptable[ARP_CLIENT].ipaddr); - if (err = nfs_lookup(ARP_SWAPSERVER, swap_nfs_port, - &swapfs_fh, swapfile, &nfsdiskless.swap_fh, &swsize)) { - printf("Unable to open %s: ",swapfile); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - if (!nfsdiskless.swap_nblks) { - nfsdiskless.swap_nblks = swsize / 1024; - printf("Swap size is: %d blocks\n",nfsdiskless.swap_nblks); - } - nfsdiskless.swap_saddr.sin_len = sizeof(struct sockaddr_in); - nfsdiskless.swap_saddr.sin_family = AF_INET; - nfsdiskless.swap_saddr.sin_port = htons(swap_nfs_port); - nfsdiskless.swap_saddr.sin_addr.s_addr = - htonl(arptable[ARP_SWAPSERVER].ipaddr); - nfsdiskless.swap_args.timeo = 10; - nfsdiskless.swap_args.retrans = 100; - } - - /* Lookup NFS/MOUNTD ports for ROOT using PORTMAP */ - root_nfs_port = rpclookup(ARP_ROOTSERVER, PROG_NFS, 2); - root_mount_port = rpclookup(ARP_ROOTSERVER, PROG_MOUNT, 1); - if ((root_nfs_port == -1) || (root_mount_port == -1)) { - printf("Unable to get ROOT NFS/MOUNT ports\n"); - longjmp(jmp_bootmenu,1); - } - if (err = nfs_mount(ARP_ROOTSERVER, root_mount_port, - nfsdiskless.root_hostnam, &nfsdiskless.root_fh)) { - printf("Unable to mount ROOT filesystem: "); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - nfsdiskless.root_saddr.sin_len = sizeof(struct sockaddr_in); - nfsdiskless.root_saddr.sin_family = AF_INET; - nfsdiskless.root_saddr.sin_port = htons(root_nfs_port); - nfsdiskless.root_saddr.sin_addr.s_addr = - htonl(arptable[ARP_ROOTSERVER].ipaddr); - nfsdiskless.root_args.timeo = 10; - nfsdiskless.root_args.retrans = 100; - nfsdiskless.root_time = 0; - - if (err = nfs_lookup(ARP_ROOTSERVER, root_nfs_port, - &nfsdiskless.root_fh, *kernel == '/' ? kernel+1 : kernel, - &kernel_handle, NULL)) { - printf("Unable to open %s: ",kernel); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - - /* Load the kernel using NFS */ - printf("Loading %s...\n",kernel); - if ((err = nfs_read(ARP_ROOTSERVER, root_nfs_port, &kernel_handle, 0, - sizeof(struct exec), &head)) < 0) { - printf("Unable to read %s: ",kernel); - nfs_err(err); - longjmp(jmp_bootmenu,1); - } - if (N_BADMAG(head)) { - printf("Bad executable format!\n"); - longjmp(jmp_bootmenu, 1); - } - loadpoint = (char *)(head.a_entry & 0x00FFFFFF); - offset = N_TXTOFF(head); - printf("text=0x%X, ",head.a_text); -#ifdef PC98 - set_twiddle_max(8); -#endif - nfsload(head.a_text); - while (((int)loadpoint) & PAGE_MASK) - *(loadpoint++) = 0; - - printf("data=0x%X, ",head.a_data); - nfsload(head.a_data); - - printf("bss=0x%X, ",head.a_bss); - while(head.a_bss--) *(loadpoint++) = 0; - - while (((int)loadpoint) & PAGE_MASK) - *(loadpoint++) = 0; - - bootinfo.bi_symtab = (int) loadpoint; - - p = (char*)&head.a_syms; - for (i=0;i<sizeof(head.a_syms);i++) - *loadpoint++ = *p++; - - printf("symbols=[+0x%x+0x%x", sizeof(head.a_syms), head.a_syms); - - nfsload(head.a_syms); - i = sizeof(int); - p = loadpoint; - nfsload(i); - i = *(int*)p; - printf("+0x%x]\n", i); - i -= sizeof(int); - nfsload(i); - bootinfo.bi_esymtab = (int) loadpoint; - - printf("entry=0x%X.\n",head.a_entry); - - /* Jump to kernel */ - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_kernelname = kernel; - bootinfo.bi_nfs_diskless = &nfsdiskless; - bootinfo.bi_size = sizeof bootinfo; - kernelentry = (void *)(head.a_entry & 0x00FFFFFF); - (*kernelentry)(howto|RB_BOOTINFO,NODEV,0,0,0,&bootinfo,0,0,0); - printf("*** %s execute failure ***\n",kernel); -} - -/************************************************************************** -POLLKBD - Check for Interrupt from keyboard -**************************************************************************/ -pollkbd() -{ -#ifndef SECURE_BOOT - if (iskey() && (getchar() == ESC)) longjmp(jmp_bootmenu,1); -#endif -} - -/************************************************************************** -DEFAULT_NETMASK - Set a default netmask for IP address -**************************************************************************/ -default_netmask() -{ - int net = arptable[ARP_CLIENT].ipaddr >> 24; - if (net <= 127) - netmask = htonl(0xff000000); - else if (net < 192) - netmask = htonl(0xffff0000); - else - netmask = htonl(0xffffff00); -} -/************************************************************************** -UDP_TRANSMIT - Send a UDP datagram -**************************************************************************/ -udp_transmit(destip, srcsock, destsock, len, buf) - unsigned long destip; - unsigned short srcsock, destsock; - int len; - char *buf; -{ - struct iphdr *ip; - struct udphdr *udp; - struct arprequest arpreq; - int arpentry, i; - unsigned long time; - int retry = MAX_ARP_RETRIES; - - ip = (struct iphdr *)buf; - udp = (struct udphdr *)(buf + sizeof(struct iphdr)); - ip->verhdrlen = 0x45; - ip->service = 0; - ip->len = htons(len); - ip->ident = 0; - ip->frags = 0; - ip->ttl = 60; - ip->protocol = IP_UDP; - ip->chksum = 0; - convert_ipaddr(ip->src, &arptable[ARP_CLIENT].ipaddr); - convert_ipaddr(ip->dest, &destip); - ip->chksum = ipchksum(buf, sizeof(struct iphdr)); - udp->src = htons(srcsock); - udp->dest = htons(destsock); - udp->len = htons(len - sizeof(struct iphdr)); - udp->chksum = 0; - if (destip == IP_BROADCAST) { - eth_transmit(broadcast, IP, len, buf); - } else { - long h_netmask = ntohl(netmask); - /* Check to see if we need gateway */ - if (((destip & h_netmask) != - (arptable[ARP_CLIENT].ipaddr & h_netmask)) && - arptable[ARP_GATEWAY].ipaddr) - destip = arptable[ARP_GATEWAY].ipaddr; - for(arpentry = 0; arpentry<MAX_ARP; arpentry++) - if (arptable[arpentry].ipaddr == destip) break; - if (arpentry == MAX_ARP) { - printf("%I is not in my arp table!\n"); - return(0); - } - for (i = 0; i<ETHER_ADDR_LEN; i++) - if (arptable[arpentry].node[i]) break; - if (i == ETHER_ADDR_LEN) { /* Need to do arp request */ - arpreq.hwtype = htons(1); - arpreq.protocol = htons(IP); - arpreq.hwlen = ETHER_ADDR_LEN; - arpreq.protolen = 4; - arpreq.opcode = htons(ARP_REQUEST); - bcopy(arptable[ARP_CLIENT].node, arpreq.shwaddr, - ETHER_ADDR_LEN); - convert_ipaddr(arpreq.sipaddr, - &arptable[ARP_CLIENT].ipaddr); - bzero(arpreq.thwaddr, ETHER_ADDR_LEN); - convert_ipaddr(arpreq.tipaddr, &destip); - while (retry--) { - eth_transmit(broadcast, ARP, sizeof(arpreq), - &arpreq); - if (await_reply(AWAIT_ARP, arpentry, - arpreq.tipaddr)) goto xmit; - } - return(0); - } -xmit: eth_transmit(arptable[arpentry].node, IP, len, buf); - } - return(1); -} - -/************************************************************************** -TFTP - Try to load configuation file -**************************************************************************/ -tftp(name) - char *name; -{ - struct tftp_t *tr; - int retry = MAX_TFTP_RETRIES; - static unsigned short isocket = 2000; - unsigned short osocket = TFTP; - unsigned short len, block=1; - struct tftp_t tp; - int code; - printf("Loading %s...\n",name); - isocket++; - tp.opcode = htons(TFTP_RRQ); - len = (sprintf((char *)tp.u.rrq,"%s%c%s",name,0,"octet") - - ((char *)&tp)) + 1; - while(retry--) { - if (!udp_transmit(arptable[ARP_SERVER].ipaddr, isocket, osocket, - len, &tp)) return(0); - if (await_reply(AWAIT_TFTP, isocket, NULL)) { - tr = (struct tftp_t *)&packet[ETHER_HDR_LEN]; - if (tr->opcode == ntohs(TFTP_ERROR)) { - printf("TFTP error %d (%s)\n", - ntohs(tr->u.err.errcode), - tr->u.err.errmsg); - return(0); - } /* ACK PACKET */ - if (tr->opcode != ntohs(TFTP_DATA)) return(0); - osocket = ntohs(tr->udp.src); - tp.opcode = htons(TFTP_ACK); - tp.u.ack.block = tr->u.data.block; - udp_transmit(arptable[ARP_SERVER].ipaddr, isocket, - osocket, TFTP_MIN_PACKET_SIZE, &tp); - len = ntohs(tr->udp.len) - sizeof(struct udphdr) - 4; - if (len >= 512) { - printf("Config file too large.\n"); - config_buffer[0] = 0; - return(0); - } else { - bcopy(tr->u.data.download, config_buffer, len); - config_buffer[len] = 0; - } - return(1); - } - } - return(0); -} - -/************************************************************************** -BOOTP - Get my IP address and load information -**************************************************************************/ -bootp() -{ - int retry = MAX_BOOTP_RETRIES; - struct bootp_t bp; - unsigned long starttime; - bzero(&bp, sizeof(struct bootp_t)); - bp.bp_op = BOOTP_REQUEST; - bp.bp_htype = 1; - bp.bp_hlen = ETHER_ADDR_LEN; - bp.bp_xid = starttime = currticks(); - bcopy(arptable[ARP_CLIENT].node, bp.bp_hwaddr, ETHER_ADDR_LEN); - while(retry--) { - udp_transmit(IP_BROADCAST, 0, BOOTP_SERVER, - sizeof(struct bootp_t), &bp); - if (await_reply(AWAIT_BOOTP, 0, NULL)) - return(1); - bp.bp_secs = htons((currticks()-starttime)/20); - } - return(0); -} - - -/************************************************************************** -AWAIT_REPLY - Wait until we get a response for our request -**************************************************************************/ -await_reply(type, ival, ptr) - int type, ival; - char *ptr; -{ - unsigned long time; - struct iphdr *ip; - struct udphdr *udp; - struct arprequest *arpreply; - struct bootp_t *bootpreply; - struct rpc_t *rpc; - - int protohdrlen = ETHER_HDR_LEN + sizeof(struct iphdr) + - sizeof(struct udphdr); - time = currticks() + TIMEOUT; - while(time > currticks()) { - pollkbd(); - if (eth_poll()) { /* We have something! */ - /* Check for ARP - No IP hdr */ - if ((type == AWAIT_ARP) && - (packetlen >= ETHER_HDR_LEN + - sizeof(struct arprequest)) && - (((packet[12] << 8) | packet[13]) == ARP)) { - arpreply = (struct arprequest *) - &packet[ETHER_HDR_LEN]; - if ((arpreply->opcode == ntohs(ARP_REPLY)) && - bcompare(arpreply->sipaddr, ptr, 4)) { - bcopy(arpreply->shwaddr, - arptable[ival].node, - ETHER_ADDR_LEN); - return(1); - } - continue; - } - - /* Anything else has IP header */ - if ((packetlen < protohdrlen) || - (((packet[12] << 8) | packet[13]) != IP)) continue; - ip = (struct iphdr *)&packet[ETHER_HDR_LEN]; - if ((ip->verhdrlen != 0x45) || - ipchksum(ip, sizeof(struct iphdr)) || - (ip->protocol != IP_UDP)) continue; - udp = (struct udphdr *)&packet[ETHER_HDR_LEN + - sizeof(struct iphdr)]; - - /* BOOTP ? */ - bootpreply = (struct bootp_t *)&packet[ETHER_HDR_LEN]; - if ((type == AWAIT_BOOTP) && - (packetlen >= (ETHER_HDR_LEN + - sizeof(struct bootp_t))) && - (ntohs(udp->dest) == BOOTP_CLIENT) && - (bootpreply->bp_op == BOOTP_REPLY)) { - convert_ipaddr(&arptable[ARP_CLIENT].ipaddr, - bootpreply->bp_yiaddr); - default_netmask(); - convert_ipaddr(&arptable[ARP_SERVER].ipaddr, - bootpreply->bp_siaddr); - bzero(arptable[ARP_SERVER].node, - ETHER_ADDR_LEN); /* Kill arp */ - convert_ipaddr(&arptable[ARP_GATEWAY].ipaddr, - bootpreply->bp_giaddr); - bzero(arptable[ARP_GATEWAY].node, - ETHER_ADDR_LEN); /* Kill arp */ - if (bootpreply->bp_file[0]) { - bcopy(bootpreply->bp_file, - kernel_buf, 128); - kernel = kernel_buf; - } - decode_rfc1048(bootpreply->bp_vend); - return(1); - } - - /* TFTP ? */ - if ((type == AWAIT_TFTP) && - (ntohs(udp->dest) == ival)) return(1); - - /* RPC */ - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if ((type == AWAIT_RPC) && - (ntohs(udp->dest) == RPC_SOCKET) && - (ntohl(rpc->u.reply.id) == ival) && - (ntohl(rpc->u.reply.type) == MSG_REPLY)) { - rpc_id++; - return(1); - } - } - } - return(0); -} - -void -bootp_string(char *name, char *bootp_ptr) -{ - char tmp_buf[512]; /* oversized, but who cares ! */ - bzero(tmp_buf, sizeof(tmp_buf)); - bcopy(bootp_ptr+2, tmp_buf, TAG_LEN(bootp_ptr)); - sprintf(config_buffer+strlen(config_buffer), - "%s %s\n", name, tmp_buf); -} - - -/************************************************************************** -DECODE_RFC1048 - Decodes RFC1048 header -**************************************************************************/ -decode_rfc1048(p) - unsigned char *p; -{ - static char rfc1048_cookie[4] = RFC1048_COOKIE; - unsigned char *end = p + BOOTP_VENDOR_LEN,*q; - if (bcompare(p, rfc1048_cookie, 4)) { /* RFC 1048 header */ - p += 4; - while(p < end) { - switch (*p) { - case RFC1048_PAD: - p++; - continue; - case RFC1048_END: - p = end; - continue; - case RFC1048_GATEWAY: - convert_ipaddr(&arptable[ARP_GATEWAY].ipaddr, - p+2); - break; - case RFC1048_NETMASK: - bcopy(p+2,&netmask,4); - break; - case RFC1048_HOSTNAME: - bcopy(p+2, &nfsdiskless.my_hostnam, TAG_LEN(p)); - hostnamelen = (TAG_LEN(p) + 3) & ~3; - break; - case RFC1048_ROOT_PATH: /* XXX check len */ - bootp_string("rootfs", p); - break; - case RFC1048_SWAP_PATH: - bootp_string("swapfs", p); - break; - case RFC1048_SWAP_LEN: /* T129 */ - sprintf(config_buffer+strlen(config_buffer), - "swapsize %d\n", ntohl(*(long *)(p+2)) ); - break; - case 130: /* root mount options */ - bootp_string("rootopts", p); - break; - case 131: /* swap mount options */ - bootp_string("swapopts", p); - break; - case 132: /* any other options */ - case 133: - case 134: - case 135: - case 136: - case 137: - case 138: - case 139: - case 140: - case 141: - bootp_string("", p); - break; - default: - printf("Unknown RFC1048-tag "); - for(q=p;q<p+2+TAG_LEN(p);q++) - printf("%x ",*q); - printf("\n"); - } - p += TAG_LEN(p) + 2; - } - } -} - -/************************************************************************** -IPCHKSUM - Checksum IP Header -**************************************************************************/ -ipchksum(ip, len) - unsigned short *ip; - int len; -{ - unsigned long sum = 0; - len >>= 1; - while (len--) { - sum += *(ip++); - if (sum > 0xFFFF) - sum -= 0xFFFF; - } - return((~sum) & 0x0000FFFF); -} - - -/************************************************************************** -CONVERT_IPADDR - Convert IP address from net to machine order -**************************************************************************/ -convert_ipaddr(d, s) - char *d,*s; -{ - *(d+3) = *s; - *(d+2) = *(s+1); - *(d+1) = *(s+2); - *d = *(s+3); -} diff --git a/sys/pc98/boot/netboot/makerom.c b/sys/pc98/boot/netboot/makerom.c deleted file mode 100644 index 51b1c2868a55..000000000000 --- a/sys/pc98/boot/netboot/makerom.c +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************ - -Program to put ROM checksum in ROM image. - -This program strips off the FreeBSD a.out header! - -************************************************************************/ -#include <stdio.h> -#include <sys/fcntl.h> - -unsigned char rom[ROMSIZE]; -unsigned int sum; - -main(argc,argv) - int argc; char *argv[]; -{ - int i, fd; - if (argc < 1) { - fprintf(stderr,"usage: %s rom-file\n",argv[0]); - exit(2); - } - if ((fd = open(argv[1], O_RDWR)) < 0) { - perror("unable to open file"); - exit(2); - } - bzero(rom, ROMSIZE); - if (lseek(fd, (off_t)32, SEEK_SET) < 0) { - perror("lseek error"); - exit(2); - } - if (read(fd, rom, ROMSIZE) < 0) { - perror("read error"); - exit(2); - } - rom[5] = 0; - for (i=0,sum=0; i<ROMSIZE; i++) - sum += rom[i]; - rom[5] = -sum; - for (i=0,sum=0; i<ROMSIZE; i++) - sum += rom[i]; - if (sum & 0x00FF) - printf("checksum fails.\n"); - if (lseek(fd, (off_t)0, SEEK_SET) < 0) { - perror("unable to seek"); - exit(2); - } - if (write(fd, rom, ROMSIZE) < 0) { - perror("unable to write"); - exit(2); - } - close(fd); - exit(0); -} diff --git a/sys/pc98/boot/netboot/misc.c b/sys/pc98/boot/netboot/misc.c deleted file mode 100644 index a2c863ea50ec..000000000000 --- a/sys/pc98/boot/netboot/misc.c +++ /dev/null @@ -1,457 +0,0 @@ -/************************************************************************** -MISC Support Routines -**************************************************************************/ - -#include "netboot.h" -#ifdef PC98 -#include "../../pc98/pc98.h" -void putchar(int c); -void putc(int c); -#endif -#define NO_SWITCH /* saves space */ - -/************************************************************************** -TWIDDLE -**************************************************************************/ -twiddle() -{ - static int count=0; - char tiddles[]="-\\|/"; - putchar(tiddles[(count++)&3]); - putchar('\b'); -} - -/************************************************************************** -BCOPY -**************************************************************************/ -bcopy(s,d,n) - char *s, *d; - int n; -{ - while ((n--) > 0) { - *(d++) = *(s++); - } -} - -/************************************************************************** -BZERO -**************************************************************************/ -bzero(d,n) - char *d; - int n; -{ - while ((n--) > 0) { - *(d++) = 0; - } -} - -/************************************************************************** -BCOMPARE -**************************************************************************/ -bcompare(d,s,n) - char *d,*s; - int n; -{ - while ((n--) > 0) { - if (*(d++) != *(s++)) return(0); - } - return(1); -} - -/************************************************************************** -SUBSTR (slightly wacky but functional) -**************************************************************************/ -char *substr(a,b) -char *a,*b; -{ -char *loc1; -char *loc2; - - while (*a != '\0') { - loc1 = a; - loc2 = b; - while (*loc1 == *loc2++) { - if (*loc1 == '\0') return (0); - loc1++; - if (*loc2 == '\0') return (loc1); - } - a++; - } - return (0); -} - -/************************************************************************** -PRINTF and friends - - Formats: - %X - 4 byte ASCII (8 hex digits) - %x - 2 byte ASCII (4 hex digits) - %b - 1 byte ASCII (2 hex digits) - %d - decimal - %c - ASCII char - %s - ASCII string - %I - Internet address in x.x.x.x notation - %L - Binary long - %S - String (multiple of 4 bytes) preceded with 4 byte - binary length - %M - Copy memory. Takes two args, len and ptr -**************************************************************************/ -static char hex[]="0123456789ABCDEF"; -char *do_printf(buf, fmt, dp) - char *buf, *fmt; - int *dp; -{ - register char *p; - char tmp[16]; - while (*fmt) { - if (*fmt == '%') { /* switch() uses more space */ - fmt++; - if (*fmt == 'L') { - register int h = *(dp++); - *(buf++) = h>>24; - *(buf++) = h>>16; - *(buf++) = h>>8; - *(buf++) = h; - } - if (*fmt == 'S') { - register int len = 0; - char *lenptr = buf; - p = (char *)*dp++; - buf += 4; - while (*p) { - *(buf++) = *p++; - len ++; - } - *(lenptr++) = len>>24; - *(lenptr++) = len>>16; - *(lenptr++) = len>>8; - *lenptr = len; - while (len & 3) { - *(buf++) = 0; - len ++; - } - } - if (*fmt == 'M') { - register int len = *(dp++); - bcopy((char *)*dp++, buf, len); - buf += len; - } - if (*fmt == 'X') { - register int h = *(dp++); - *(buf++) = hex[(h>>28)& 0x0F]; - *(buf++) = hex[(h>>24)& 0x0F]; - *(buf++) = hex[(h>>20)& 0x0F]; - *(buf++) = hex[(h>>16)& 0x0F]; - *(buf++) = hex[(h>>12)& 0x0F]; - *(buf++) = hex[(h>>8)& 0x0F]; - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'x') { - register int h = *(dp++); - *(buf++) = hex[(h>>12)& 0x0F]; - *(buf++) = hex[(h>>8)& 0x0F]; - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'b') { - register int h = *(dp++); - *(buf++) = hex[(h>>4)& 0x0F]; - *(buf++) = hex[h& 0x0F]; - } - if (*fmt == 'd') { - register int dec = *(dp++); - p = tmp; - if (dec < 0) { - *(buf++) = '-'; - dec = -dec; - } - do { - *(p++) = '0' + (dec%10); - dec = dec/10; - } while(dec); - while ((--p) >= tmp) *(buf++) = *p; - } - if (*fmt == 'I') { - buf = sprintf(buf,"%d.%d.%d.%d", - (*(dp)>>24) & 0x00FF, - (*(dp)>>16) & 0x00FF, - (*(dp)>>8) & 0x00FF, - *dp & 0x00FF); - dp++; - } - if (*fmt == 'c') - *(buf++) = *(dp++); - if (*fmt == 's') { - p = (char *)*dp++; - while (*p) *(buf++) = *p++; - } - } else *(buf++) = *fmt; - fmt++; - } - *buf = 0; - return(buf); -} - -char *sprintf(buf, fmt, data) - char *fmt, *buf; - int data; -{ - return(do_printf(buf,fmt, &data)); -} - -printf(fmt,data) - char *fmt; - int data; -{ - char buf[1024],*p; - p = buf; - do_printf(buf,fmt,&data); - while (*p) { - if (*p=='\n') putchar('\r'); - putchar(*p++); - } -} - -/************************************************************************** -SETIP - Convert an ascii x.x.x.x to binary form -**************************************************************************/ -setip(p, i) - char *p; - unsigned *i; -{ - unsigned ip = 0; - int val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = (ip << 8) | val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - if (*p != '.') return(0); - p++; - ip = (ip << 8) | val; - if (((val = getdec(&p)) < 0) || (val > 255)) return(0); - *i = (ip << 8) | val; - return(1); -} - -getdec(ptr) - char **ptr; -{ - char *p = *ptr; - int ret=0; - if ((*p < '0') || (*p > '9')) return(-1); - while ((*p >= '0') && (*p <= '9')) { - ret = ret*10 + (*p - '0'); - p++; - } - *ptr = p; - return(ret); -} - - -#define K_RDWR 0x60 /* keyboard data & cmds (read/write) */ -#define K_STATUS 0x64 /* keyboard status */ -#define K_CMD 0x64 /* keybd ctlr command (write-only) */ - -#define K_OBUF_FUL 0x01 /* output buffer full */ -#define K_IBUF_FUL 0x02 /* input buffer full */ - -#define KC_CMD_WIN 0xd0 /* read output port */ -#define KC_CMD_WOUT 0xd1 /* write output port */ -#define KB_A20 0x9f /* enable A20, - enable output buffer full interrupt - enable data line - disable clock line */ - -/* - * Gate A20 for high memory - */ -unsigned char x_20 = KB_A20; -gateA20() -{ -#ifdef PC98 - outb(0xf2, 0x00); - outb(0xf6, 0x02); -#else -#ifdef IBM_L40 - outb(0x92, 0x2); -#else IBM_L40 - while (inb(K_STATUS) & K_IBUF_FUL); - while (inb(K_STATUS) & K_OBUF_FUL) - (void)inb(K_RDWR); - - outb(K_CMD, KC_CMD_WOUT); - while (inb(K_STATUS) & K_IBUF_FUL); - outb(K_RDWR, x_20); - while (inb(K_STATUS) & K_IBUF_FUL); -#endif IBM_L40 -#endif -} - -#ifdef PC98 -void -putchar(int c) -{ - if (c == '\n') - putc('\r'); - putc(c); -} - -static unsigned short *Crtat = (unsigned short *)0; -static int row; -static int col; - -void putc(int c) -{ - static unsigned short *crtat; - unsigned char sys_type; - unsigned short *cp; - int i, pos; - - if (Crtat == 0) { - sys_type = *(unsigned char *)0x0a1501/*0x11501*/; - if (sys_type & 0x08) { - Crtat = (unsigned short *)0x0e0000/*0x50000*/; - crtat = Crtat; - row = 31; - col = 80; - } else { - Crtat = (unsigned short *)0x0a0000/*0x10000*/; - crtat = Crtat; - row = 25; - col = 80; - } - } - - switch(c) { - case '\t': - do { - putc(' '); - } while ((int)crtat % 16); - break; - case '\b': - crtat--; - break; - case '\r': - crtat -= (crtat - Crtat) % col; - break; - case '\n': - crtat += col; - break; - default: - *crtat = (c == 0x5c ? 0xfc : c); - *(crtat++ + 0x1000) = 0xe1; - break; - } - - if (crtat >= Crtat + col * row) { - for (i = 1; i < row; i++) - bcopy(Crtat+col*i, Crtat+col*(i-1), col*2); - for (i = 0, cp = Crtat + col * (row - 1); i < col*2; i++) { - *cp++ = ' '; - } - crtat -= col; - } - pos = crtat - Crtat; - while((inb(0x60) & 0x04) == 0) {} - outb(0x62, 0x49); - outb(0x60, pos & 0xff); - outb(0x60, pos >> 8); -} - -unsigned int bios98getdate(); - -unsigned int currticks() -{ - unsigned int biostime = bios98getdate() >> 8; - unsigned int time; - static unsigned int oldtime; - time = (( (biostime >> 4) & 0x0f)*10 - + (biostime & 0x0f))*3600 /* hour */ - + (((biostime >> 12) & 0x0f)*10 - + ((biostime >> 8) & 0x0f))*60 /* minute */ - + (((biostime >> 20) & 0x0f)*10 - + ((biostime >> 16) & 0x0f)); /* second */ - while(oldtime > time) - time += 24*3600; - oldtime = time; - return time*20; -} - -void machine_check(void) -{ - int ret; - int i; - int data = 0; - u_char epson_machine_id = *(unsigned char *)(0x0a1624/*0x11624*/); - - /* PC98_SYSTEM_PARAMETER(0x501) */ - ret = ((*(unsigned char*)0x0a1501/*0x11501*/) & 0x08) >> 3; - - /* wait V-SYNC */ - while (inb(0x60) & 0x20) {} - while (!(inb(0x60) & 0x20)) {} - - /* ANK 'A' font */ - outb(0xa1, 0x00); - outb(0xa3, 0x41); - - if (ret & M_NORMAL) { - /* M_NORMAL, use CG window (all NEC OK) */ - /* sum */ - for (i = 0; i < 4; i++) { - data += *((unsigned long*)0x0a4000/*0x14000*/ + i);/* 0xa4000 */ - } - if (data == 0x6efc58fc) { /* DA data */ - ret |= M_NEC_PC98; - } else { - ret |= M_EPSON_PC98; - } - ret |= (inb(0x42) & 0x20) ? M_8M : 0; - } else { - /* M_HIGHRESO, use CG window */ - /* sum */ - for (i = 0; i < 12; i++) { - data += *((unsigned long*)0x0e4000/*0x54000*/ + i); /* 0xe4000 */ - } - if ( data == 0x50154624) { /* XA data */ - ret |= M_NEC_PC98; - } else { - ret |= M_EPSON_PC98; - } - ret |= (inb(0x63) & 0x01) ? M_8M : 0; - } - - /* PC98_SYSTEM_PARAMETER(0x400) */ - if ((*(unsigned char*)0xa1400/*0x11400*/) & 0x80) { - ret |= M_NOTE; - } - if (ret & M_NEC_PC98) { - /* PC98_SYSTEM_PARAMETER(0x458) */ - if ((*(unsigned char*)0x0a1458/*0x11458*/) & 0x80) { - ret |= M_H98; - } else { - ret |= M_NOT_H98; - } - } else { - ret |= M_NOT_H98; - switch (epson_machine_id) { - case 0x20: /* note A */ - case 0x22: /* note W */ - case 0x27: /* note AE */ - case 0x2a: /* note WR */ - /*case 0x2: /* note AR */ - ret |= M_NOTE; - break; - default: - break; - } - } - (*(unsigned long *)(0x0a1620/*0x11620*/)) = ret; -} -#endif diff --git a/sys/pc98/boot/netboot/netboot.h b/sys/pc98/boot/netboot/netboot.h deleted file mode 100644 index 0e922b760401..000000000000 --- a/sys/pc98/boot/netboot/netboot.h +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Dec/93 - -**************************************************************************/ - -#include <sys/types.h> -#include <sys/reboot.h> -#include <a.out.h> -#include <netdb.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <sys/time.h> -#include <net/ethernet.h> -#include <net/if.h> -#include <netinet/in.h> -#include <nfs/nfsv2.h> -#include <nfs/rpcv2.h> -#include <nfs/nfs.h> -#include <nfs/nfsdiskless.h> -#include <machine/bootinfo.h> -#include <machine/cpufunc.h> - -#define ESC 0x1B - -#ifndef DEFAULT_BOOTFILE -#define DEFAULT_BOOTFILE "/kernel" -#endif - -#ifndef MAX_TFTP_RETRIES -#define MAX_TFTP_RETRIES 20 -#endif - -#ifndef MAX_BOOTP_RETRIES -#define MAX_BOOTP_RETRIES 20 -#endif - -#ifndef MAX_ARP_RETRIES -#define MAX_ARP_RETRIES 20 -#endif - -#ifndef MAX_RPC_RETRIES -#define MAX_RPC_RETRIES 20 -#endif - -#ifndef TIMEOUT /* Inter-packet retry in ticks 18/sec */ -#define TIMEOUT 20 -#endif - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#define TRUE 1 -#define FALSE 0 - -#define VENDOR_NONE 0 -#define VENDOR_WD 1 -#define VENDOR_NOVELL 2 -#define VENDOR_3COM 3 -#define VENDOR_3C509 4 - -#define FLAG_PIO 0x01 -#define FLAG_16BIT 0x02 -#define FLAG_790 0x04 - -#define ARP_CLIENT 0 -#define ARP_SERVER 1 -#define ARP_GATEWAY 2 -#define ARP_NS 3 -#define ARP_ROOTSERVER 4 -#define ARP_SWAPSERVER 5 -#define MAX_ARP ARP_SWAPSERVER+1 - -#define IP 0x0800 -#define ARP 0x0806 - -#define BOOTP_SERVER 67 -#define BOOTP_CLIENT 68 -#define TFTP 69 -#define SUNRPC 111 - -#define RPC_SOCKET 620 /* Arbitrary */ - -#define IP_UDP 17 -#define IP_BROADCAST 0xFFFFFFFF - -#define ARP_REQUEST 1 -#define ARP_REPLY 2 - -#define BOOTP_REQUEST 1 -#define BOOTP_REPLY 2 - -#define TAG_LEN(p) (*((p)+1)) -#define RFC1048_COOKIE { 99, 130, 83, 99 } -#define RFC1048_PAD 0 -#define RFC1048_NETMASK 1 -#define RFC1048_TIME_OFFSET 2 -#define RFC1048_GATEWAY 3 -#define RFC1048_TIME_SERVER 4 -#define RFC1048_NAME_SERVER 5 -#define RFC1048_DOMAIN_SERVER 6 -#define RFC1048_HOSTNAME 12 -#define RFC1048_BOOT_SIZE 12 /* XXX */ -#define RFC1048_SWAP_SERVER 16 -#define RFC1048_ROOT_PATH 17 -#define RFC1048_SWAP_PATH 128 /* T128 */ -#define RFC1048_SWAP_LEN 129 /* T129 */ - -#define RFC1048_END 255 -#define BOOTP_VENDOR_LEN 256 - -#define TFTP_RRQ 1 -#define TFTP_WRQ 2 -#define TFTP_DATA 3 -#define TFTP_ACK 4 -#define TFTP_ERROR 5 - -#define TFTP_CODE_EOF 1 -#define TFTP_CODE_MORE 2 -#define TFTP_CODE_ERROR 3 -#define TFTP_CODE_BOOT 4 -#define TFTP_CODE_CFG 5 - -#define PROG_PORTMAP 100000 -#define PROG_NFS 100003 -#define PROG_MOUNT 100005 - -#define MSG_CALL 0 -#define MSG_REPLY 1 - -#define PORTMAP_LOOKUP 3 - -#define MOUNT_ADDENTRY 1 -#define NFS_LOOKUP 4 -#define NFS_READ 6 - -#define NFS_READ_SIZE 1024 - - -#define AWAIT_ARP 0 -#define AWAIT_BOOTP 1 -#define AWAIT_TFTP 2 -#define AWAIT_RPC 3 - -struct arptable_t { - unsigned long ipaddr; - unsigned char node[6]; -} arptable[MAX_ARP]; - -struct arprequest { - unsigned short hwtype; - unsigned short protocol; - char hwlen; - char protolen; - unsigned short opcode; - char shwaddr[6]; - char sipaddr[4]; - char thwaddr[6]; - char tipaddr[4]; -}; - -struct iphdr { - char verhdrlen; - char service; - unsigned short len; - unsigned short ident; - unsigned short frags; - char ttl; - char protocol; - unsigned short chksum; - char src[4]; - char dest[4]; -}; - -struct udphdr { - unsigned short src; - unsigned short dest; - unsigned short len; - unsigned short chksum; -}; - -struct bootp_t { - struct iphdr ip; - struct udphdr udp; - char bp_op; - char bp_htype; - char bp_hlen; - char bp_hops; - unsigned long bp_xid; - unsigned short bp_secs; - unsigned short unused; - char bp_ciaddr[4]; - char bp_yiaddr[4]; - char bp_siaddr[4]; - char bp_giaddr[4]; - char bp_hwaddr[16]; - char bp_sname[64]; - char bp_file[128]; - char bp_vend[BOOTP_VENDOR_LEN]; -}; - -struct tftp_t { - struct iphdr ip; - struct udphdr udp; - unsigned short opcode; - union { - char rrq[512]; - struct { - unsigned short block; - char download[512]; - } data; - struct { - unsigned short block; - } ack; - struct { - unsigned short errcode; - char errmsg[512]; - } err; - } u; -}; - -struct rpc_t { - struct iphdr ip; - struct udphdr udp; - union { - char data[1400]; - struct { - long id; - long type; - long rstatus; - long verifier; - long v2; - long astatus; - long data[1]; - } reply; - } u; -}; - -#define TFTP_MIN_PACKET_SIZE (sizeof(struct iphdr) + sizeof(struct udphdr) + 4) - -/*************************************************************************** -RPC Functions -***************************************************************************/ -#define PUTLONG(val) {\ - register int lval = val; \ - *(rpcptr++) = ((lval) >> 24); \ - *(rpcptr++) = ((lval) >> 16); \ - *(rpcptr++) = ((lval) >> 8); \ - *(rpcptr++) = (lval); \ - rpclen+=4; } - -char *sprintf(); diff --git a/sys/pc98/boot/netboot/ns8390.c b/sys/pc98/boot/netboot/ns8390.c deleted file mode 100644 index 451d3037186a..000000000000 --- a/sys/pc98/boot/netboot/ns8390.c +++ /dev/null @@ -1,762 +0,0 @@ - -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: May/94 - - This code is based heavily on David Greenman's if_ed.c driver - - Copyright (C) 1993-1994, David Greenman, Martin Renters. - This software may be used, modified, copied, distributed, and sold, in - both source and binary form provided that the above copyright and these - terms are retained. Under no circumstances are the authors responsible for - the proper functioning of this software, nor do the authors assume any - responsibility for damages incurred with its use. - -3c503 support added by Bill Paul (wpaul@ctr.columbia.edu) on 11/15/94 -SMC8416 support added by Bill Paul (wpaul@ctr.columbia.edu) on 12/25/94 - -**************************************************************************/ - -DELAY(int x) -{ volatile long a, b, l; - for (x; x>0; x--) b=a; -} - -#include "netboot.h" -#include "ns8390.h" - -#ifdef _3COM_USE_AUI -short aui=1; -#else -short aui=0; -#endif - -unsigned short eth_nic_base; -unsigned short eth_asic_base; -unsigned char eth_tx_start; -unsigned char eth_laar; -unsigned char eth_flags; -unsigned char eth_vendor; -unsigned char eth_memsize; -unsigned char *eth_bmem; -unsigned char *eth_rmem; -unsigned char *eth_node_addr; -#ifdef PC98 -int twiddle_max = 1; -int twiddle_counter = 0; -#endif - -/************************************************************************** -The following two variables are used externally -**************************************************************************/ -char eth_driver[] = "ed0"; -char packet[ETHER_MAX_LEN]; -int packetlen; - -#ifdef PC98 -#ifdef INCLUDE_LGY -int type98 = TYPE98_LGY; -#endif -#ifdef INCLUDE_EGY -int type98 = TYPE98_EGY; -#endif -#endif - -#if defined(INCLUDE_NE) || defined(INCLUDE_LGY) || defined(INCLUDE_EGY) -static unsigned short ne_base_list[]= { -#ifdef NE_BASE - NE_BASE, -#endif - 0xff80, 0xff40, 0xff00, 0xfec0, - 0x280, 0x300, 0 -}; -#endif -/************************************************************************** -ETH_PROBE - Look for an adapter -**************************************************************************/ -eth_probe() -{ - int i; - struct wd_board *brd; - char *name; - unsigned short chksum; - unsigned char c; - - eth_vendor = VENDOR_NONE; - -#ifdef INCLUDE_WD - /****************************************************************** - Search for WD/SMC cards - ******************************************************************/ - for (eth_asic_base = WD_LOW_BASE; eth_asic_base <= WD_HIGH_BASE; - eth_asic_base += 0x20) { - chksum = 0; - /* Check for WD/SMC card by checking ethernet address */ - if (inb(eth_asic_base+8) != 0) continue; - if (inb(eth_asic_base+9) != 0xE0) { - if (inb(eth_asic_base+9) != 0) continue; - if (inb(eth_asic_base+10) != 0xC0) continue; - } - for (i=8; i<16; i++) - chksum += inb(i+eth_asic_base); - if ((chksum & 0x00FF) == 0x00FF) - break; - } - if (eth_asic_base <= WD_HIGH_BASE) { /* We've found a board */ - eth_vendor = VENDOR_WD; - eth_nic_base = eth_asic_base + WD_NIC_ADDR; - c = inb(eth_asic_base+WD_BID); /* Get board id */ - for (brd = wd_boards; brd->name; brd++) - if (brd->id == c) break; - if (!brd->name) { - printf("\nUnknown Ethernet type %x\n", c); - return(0); /* Unknown type */ - } - eth_flags = brd->flags; - eth_memsize = brd->memsize; - eth_tx_start = 0; - if ((c == TYPE_WD8013EP) && - (inb(eth_asic_base + WD_ICR) & WD_ICR_16BIT)) { - eth_flags = FLAG_16BIT; - eth_memsize = MEM_16384; - } - if ((c & WD_SOFTCONFIG) && (!(eth_flags & FLAG_790))) { - eth_bmem = (char *)(0x80000 | - ((inb(eth_asic_base + WD_MSR) & 0x3F) << 13)); - } else - eth_bmem = (char *)WD_DEFAULT_MEM; - if (brd->id == TYPE_SMC8216T || brd->id == TYPE_SMC8216C) { - (unsigned int) *(eth_bmem + 8192) = (unsigned int)0; - if ((unsigned int) *(eth_bmem + 8192)) { - brd += 2; - eth_memsize = brd->memsize; - } - } - outb(eth_asic_base + WD_MSR, 0x80); /* Reset */ - printf("\n%s base 0x%x, memory 0x%X, addr ", - brd->name, eth_asic_base, eth_bmem); - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = - inb(i+eth_asic_base+WD_LAR))); - if (i < 5) printf (":"); - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base+WD_MSR, WD_MSR_MENB); - outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) | - 0x80)); - outb(eth_asic_base+0x0B, - (((unsigned)eth_bmem >> 13) & 0x0F) | - (((unsigned)eth_bmem >> 11) & 0x40) | - (inb(eth_asic_base+0x0B) & 0xB0)); - outb(eth_asic_base+0x04, (inb(eth_asic_base+0x04) & - ~0x80)); - } else { - outb(eth_asic_base+WD_MSR, - (((unsigned)eth_bmem >> 13) & 0x3F) | 0x40); - } - if (eth_flags & FLAG_16BIT) { - if (eth_flags & FLAG_790) { - eth_laar = inb(eth_asic_base + WD_LAAR); - outb(eth_asic_base + WD_LAAR, WD_LAAR_M16EN); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } else { - outb(eth_asic_base + WD_LAAR, (eth_laar = - WD_LAAR_M16EN | WD_LAAR_L16EN | 1)); - } - } - goto found_board; - } -#endif -#ifdef INCLUDE_3COM - /****************************************************************** - Search for 3Com 3c503 if no WD/SMC cards - ******************************************************************/ - if (eth_vendor == VENDOR_NONE) { - eth_asic_base = _3COM_BASE + _3COM_ASIC_OFFSET; - eth_nic_base = _3COM_BASE; - eth_vendor = VENDOR_3COM; - /* - * Note that we use the same settings for both 8 and 16 bit cards: - * both have an 8K bank of memory at page 1 while only the 16 bit - * cards have a bank at page 0. - */ - eth_memsize = MEM_16384; - eth_tx_start = 32; - - /* Check our base address */ - - switch(inb(eth_asic_base + _3COM_BCFR)) { - case _3COM_BCFR_300: - if ((int)eth_nic_base != 0x300) - return(0); - break; - case _3COM_BCFR_310: - if ((int)eth_nic_base != 0x310) - return(0); - break; - case _3COM_BCFR_330: - if ((int)eth_nic_base != 0x330) - return(0); - break; - case _3COM_BCFR_350: - if ((int)eth_nic_base != 0x350) - return(0); - break; - case _3COM_BCFR_250: - if ((int)eth_nic_base != 0x250) - return(0); - break; - case _3COM_BCFR_280: - if ((int)eth_nic_base != 0x280) - return(0); - break; - case _3COM_BCFR_2A0: - if ((int)eth_nic_base != 0x2a0) - return(0); - break; - case _3COM_BCFR_2E0: - if ((int)eth_nic_base != 0x2e0) - return(0); - break; - default: - return (0); - } - - /* Now get the shared memory address */ - - switch (inb(eth_asic_base + _3COM_PCFR)) { - case _3COM_PCFR_DC000: - eth_bmem = (char *)0xdc000; - break; - case _3COM_PCFR_D8000: - eth_bmem = (char *)0xd8000; - break; - case _3COM_PCFR_CC000: - eth_bmem = (char *)0xcc000; - break; - case _3COM_PCFR_C8000: - eth_bmem = (char *)0xc8000; - break; - default: - return (0); - } - - /* Need this to make eth_poll() happy. */ - - eth_rmem = eth_bmem - 0x2000; - - /* Reset NIC and ASIC */ - - outb (eth_asic_base + _3COM_CR , _3COM_CR_RST | _3COM_CR_XSEL); - outb (eth_asic_base + _3COM_CR , _3COM_CR_XSEL); - - /* Get our ethernet address */ - - outb(eth_asic_base + _3COM_CR, _3COM_CR_EALO | _3COM_CR_XSEL); - printf("\n3Com 3c503 base 0x%x, memory 0x%X addr ", - eth_nic_base, eth_bmem); - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = - inb(eth_nic_base+i))); - if (i < 5) printf (":"); - } - outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL); - /* - * Initialize GA configuration register. Set bank and enable shared - * mem. We always use bank 1. - */ - outb(eth_asic_base + _3COM_GACFR, _3COM_GACFR_RSEL | - _3COM_GACFR_MBS0); - - outb(eth_asic_base + _3COM_VPTR2, 0xff); - outb(eth_asic_base + _3COM_VPTR1, 0xff); - outb(eth_asic_base + _3COM_VPTR0, 0x00); - /* - * Clear memory and verify that it worked (we use only 8K) - */ - bzero(eth_bmem, 0x2000); - for(i = 0; i < 0x2000; ++i) - if (*((eth_bmem)+i)) { - printf ("Failed to clear 3c503 shared mem.\n"); - return (0); - } - /* - * Initialize GA page/start/stop registers. - */ - outb(eth_asic_base + _3COM_PSTR, eth_tx_start); - outb(eth_asic_base + _3COM_PSPR, eth_memsize); - - goto found_board; - - } -#endif -#if defined(INCLUDE_NE) || defined(INCLUDE_LGY) || defined(INCLUDE_EGY) - /****************************************************************** - Search for NE1000/2000 if no WD/SMC or 3com cards - ******************************************************************/ - if (eth_vendor == VENDOR_NONE) { - char romdata[16], testbuf[32]; - char test[] = "NE1000/2000 memory"; - unsigned short *tent_base=ne_base_list; - eth_bmem = (char *)0; /* No shared memory */ -ne_again: - eth_asic_base = *tent_base + NE_ASIC_OFFSET; - eth_nic_base = *tent_base; -#ifdef PC98 - printf("Looking for LGY/EGY at 0x%x\n", eth_nic_base); -#else - printf("Looking for NE1000/NE2000 at 0x%x\n", eth_nic_base); -#endif - eth_vendor = VENDOR_NOVELL; - eth_flags = FLAG_PIO; - eth_memsize = MEM_16384; - eth_tx_start = 32; -#ifdef GWETHER - outb(eth_asic_base + NE_RESET, 0); - DELAY(200); -#endif - c = inb(eth_asic_base + NE_RESET); - outb(eth_asic_base + NE_RESET, c); - DELAY(5000); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_STP | - D8390_COMMAND_RD2); - outb(eth_nic_base + D8390_P0_RCR, D8390_RCR_MON); - outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_FT1 | D8390_DCR_LS); - outb(eth_nic_base + D8390_P0_PSTART, MEM_8192); - outb(eth_nic_base + D8390_P0_PSTOP, MEM_16384); - eth_pio_write(test, 8192, sizeof(test)); - eth_pio_read(8192, testbuf, sizeof(test)); - if (!bcompare(test, testbuf, sizeof(test))) { - eth_flags |= FLAG_16BIT; - eth_memsize = MEM_32768; - eth_tx_start = 64; - outb(eth_nic_base + D8390_P0_DCR, D8390_DCR_WTS | - D8390_DCR_FT1 | D8390_DCR_LS); - outb(eth_nic_base + D8390_P0_PSTART, MEM_16384); - outb(eth_nic_base + D8390_P0_PSTOP, MEM_32768); - eth_pio_write(test, 16384, sizeof(test)); - eth_pio_read(16384, testbuf, sizeof(test)); - if (!bcompare(testbuf, test, sizeof(test))) - if (*++tent_base) - goto ne_again; - else - return (0); - } - eth_pio_read(0, romdata, 16); -#ifdef PC98 - printf("\n%s base 0x%x, addr ", - type98 == TYPE98_LGY ? "Ethernet adapter LGY-98" : - (type98 == TYPE98_EGY ? "Ethernet adapter EGY-98" : - (type98 == TYPE98_ICM ? "Ethernet adapter ICM" : - "Unknown")), - eth_nic_base); -#else - printf("\nNE1000/NE2000 (%d bit) base 0x%x, addr ", - eth_flags & FLAG_16BIT ? 16:8, eth_nic_base); -#endif - for (i=0; i<6; i++) { - printf("%b",(int)(arptable[ARP_CLIENT].node[i] = romdata[i - + ((eth_flags & FLAG_16BIT) ? i : 0)])); - if (i < 5) printf (":"); - } - goto found_board; - } -#endif -found_board: - printf("\n"); - if (eth_vendor == VENDOR_NONE) return(0); - - if (eth_vendor != VENDOR_3COM) eth_rmem = eth_bmem; - eth_node_addr = arptable[ARP_CLIENT].node; - eth_reset(); - return(eth_vendor); -} - -/************************************************************************** -ETH_RESET - Reset adapter -**************************************************************************/ -eth_reset() -{ - int i; - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, - D8390_COMMAND_PS0 | D8390_COMMAND_STP); - else - outb(eth_nic_base+D8390_P0_COMMAND, - D8390_COMMAND_PS0 | D8390_COMMAND_RD2 | - D8390_COMMAND_STP); - if (eth_flags & FLAG_16BIT) - outb(eth_nic_base+D8390_P0_DCR, 0x49); - else - outb(eth_nic_base+D8390_P0_DCR, 0x48); - outb(eth_nic_base+D8390_P0_RBCR0, 0); - outb(eth_nic_base+D8390_P0_RBCR1, 0); - outb(eth_nic_base+D8390_P0_RCR, 4); /* allow broadcast frames */ - outb(eth_nic_base+D8390_P0_TCR, 2); - outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start); - outb(eth_nic_base+D8390_P0_PSTART, eth_tx_start + D8390_TXBUF_SIZE); - if (eth_flags & FLAG_790) outb(eth_nic_base + 0x09, 0); - outb(eth_nic_base+D8390_P0_PSTOP, eth_memsize); - outb(eth_nic_base+D8390_P0_BOUND, eth_tx_start + D8390_TXBUF_SIZE); - outb(eth_nic_base+D8390_P0_ISR, 0xFF); - outb(eth_nic_base+D8390_P0_IMR, 0); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 | - D8390_COMMAND_STP); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1 | - D8390_COMMAND_RD2 | D8390_COMMAND_STP); - for (i=0; i<6; i++) -#ifdef INCLUDE_EGY - outb(eth_nic_base+D8390_P1_PAR0+i*2, eth_node_addr[i]); /* for EGY-98 XXX HN2 */ -#else - outb(eth_nic_base+D8390_P1_PAR0+i, eth_node_addr[i]); -#endif - for (i=0; i<6; i++) - outb(eth_nic_base+D8390_P1_MAR0+i, 0xFF); - outb(eth_nic_base+D8390_P1_CURR, eth_tx_start + D8390_TXBUF_SIZE+1); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_RD2 | D8390_COMMAND_STA); - outb(eth_nic_base+D8390_P0_ISR, 0xFF); - outb(eth_nic_base+D8390_P0_TCR, 0); -#ifdef INCLUDE_3COM - if (eth_vendor == VENDOR_3COM) { - /* - * No way to tell whether or not we're supposed to use - * the 3Com's transceiver unless the user tells us. - * 'aui' should have some compile time default value - * which can be changed from the command menu. - */ - if (aui) - outb(eth_asic_base + _3COM_CR, 0); - else - outb(eth_asic_base + _3COM_CR, _3COM_CR_XSEL); - } -#endif - return(1); -} - -/************************************************************************** -ETH_TRANSMIT - Transmit a frame -**************************************************************************/ -eth_transmit(d,t,s,p) - char *d; /* Destination */ - unsigned short t; /* Type */ - unsigned short s; /* size */ - char *p; /* Packet */ -{ - unsigned char c; -#ifdef INCLUDE_3COM - if (eth_vendor == VENDOR_3COM) { - bcopy(d, eth_bmem, 6); /* dst */ - bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_LEN); /* src */ - *(eth_bmem+12) = t>>8; /* type */ - *(eth_bmem+13) = t; - bcopy(p, eth_bmem+14, s); - s += 14; - while (s < ETHER_MIN_LEN) *(eth_bmem+(s++)) = 0; - } -#endif -#ifdef INCLUDE_WD - if (eth_vendor == VENDOR_WD) { /* Memory interface */ - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, WD_MSR_MENB); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - bcopy(d, eth_bmem, 6); /* dst */ - bcopy(eth_node_addr, eth_bmem+6, ETHER_ADDR_LEN); /* src */ - *(eth_bmem+12) = t>>8; /* type */ - *(eth_bmem+13) = t; - bcopy(p, eth_bmem+14, s); - s += 14; - while (s < ETHER_MIN_LEN) *(eth_bmem+(s++)) = 0; - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, 0); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar & ~WD_LAAR_M16EN); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - } -#endif -#if defined(INCLUDE_NE) || defined(INCLUDE_LGY) || defined(INCLUDE_EGY) - if (eth_vendor == VENDOR_NOVELL) { /* Programmed I/O */ - unsigned short type; - type = (t >> 8) | (t << 8); - eth_pio_write(d, eth_tx_start<<8, 6); - eth_pio_write(eth_node_addr, (eth_tx_start<<8)+6, 6); - eth_pio_write(&type, (eth_tx_start<<8)+12, 2); - eth_pio_write(p, (eth_tx_start<<8)+14, s); - s += 14; - if (s < ETHER_MIN_LEN) s = ETHER_MIN_LEN; - } -#endif -#ifndef PC98 - twiddle(); -#else - if (twiddle_counter-- <= 0) { - twiddle(); - twiddle_counter = twiddle_max; - } -#endif - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_RD2 | D8390_COMMAND_STA); - outb(eth_nic_base+D8390_P0_TPSR, eth_tx_start); - outb(eth_nic_base+D8390_P0_TBCR0, s); - outb(eth_nic_base+D8390_P0_TBCR1, s>>8); - if (eth_flags & FLAG_790) - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_STA); - else - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0 | - D8390_COMMAND_TXP | D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - return(0); -} - -void -set_twiddle_max(int max) -{ - twiddle_max = max; -} - -/************************************************************************** -ETH_POLL - Wait for a frame -**************************************************************************/ -eth_poll() -{ - int ret = 0; - unsigned short type = 0; - unsigned char bound,curr,rstat; - unsigned short len, copylen; - unsigned short pktoff; - unsigned char *p; - struct ringbuffer pkthdr; - rstat = inb(eth_nic_base+D8390_P0_RSR); - if (rstat & D8390_RSTAT_OVER) { - eth_reset(); - return(0); - } - if (!(rstat & D8390_RSTAT_PRX)) return(0); - bound = inb(eth_nic_base+D8390_P0_BOUND)+1; - if (bound == eth_memsize) bound = eth_tx_start + D8390_TXBUF_SIZE; - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS1); - curr = inb(eth_nic_base+D8390_P1_CURR); - outb(eth_nic_base+D8390_P0_COMMAND, D8390_COMMAND_PS0); - if (curr == eth_memsize) curr=eth_tx_start + D8390_TXBUF_SIZE; - if (curr == bound) return(0); - if (eth_vendor == VENDOR_WD) { - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar | WD_LAAR_M16EN); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, WD_MSR_MENB); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - pktoff = (bound << 8); - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, &pkthdr, 4); - else - bcopy(eth_rmem + pktoff, &pkthdr, 4); - len = pkthdr.len - 4; /* sub CRC */ - pktoff += 4; - if (len > 1514) len = 1514; - bound = pkthdr.bound; /* New bound ptr */ - if ( (pkthdr.status & D8390_RSTAT_PRX) && (len > 14) && (len < 1518)) { - p = packet; - packetlen = copylen = len; - len = (eth_memsize << 8) - pktoff; - if (packetlen > len) { /* We have a wrap-around */ - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, len); - else - bcopy(eth_rmem + pktoff, p, len); - pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8; - p += len; - copylen -= len; - } - if (eth_flags & FLAG_PIO) - eth_pio_read(pktoff, p, copylen); - else - bcopy(eth_rmem + pktoff, p, copylen); - - type = (packet[12]<<8) | packet[13]; - ret = 1; - } - if (eth_vendor == VENDOR_WD) { - if (eth_flags & FLAG_790) { - outb(eth_asic_base + WD_MSR, 0); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - if (eth_flags & FLAG_16BIT) { - outb(eth_asic_base + WD_LAAR, eth_laar & - ~WD_LAAR_M16EN); -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } -#ifndef PC98 - inb(0x84); -#else - (void)outb(0x5f,0); -#endif - } - if (bound == (eth_tx_start + D8390_TXBUF_SIZE)) - bound = eth_memsize; - outb(eth_nic_base+D8390_P0_BOUND, bound-1); - if (ret && (type == ARP)) { - struct arprequest *arpreq; - unsigned long reqip; - arpreq = (struct arprequest *)&packet[ETHER_HDR_LEN]; - convert_ipaddr(&reqip, arpreq->tipaddr); - if ((ntohs(arpreq->opcode) == ARP_REQUEST) && - (reqip == arptable[ARP_CLIENT].ipaddr)) { - arpreq->opcode = htons(ARP_REPLY); - bcopy(arpreq->sipaddr, arpreq->tipaddr, 4); - bcopy(arpreq->shwaddr, arpreq->thwaddr, 6); - bcopy(arptable[ARP_CLIENT].node, arpreq->shwaddr, 6); - convert_ipaddr(arpreq->sipaddr, &reqip); - eth_transmit(arpreq->thwaddr, ARP, sizeof(struct arprequest), - arpreq); - return(0); - } - } - return(ret); -} - -#if defined(INCLUDE_NE) || defined(INCLUDE_LGY) || defined(INCLUDE_EGY) -/************************************************************************** -ETH_PIO_READ - Read a frame via Programmed I/O -**************************************************************************/ -eth_pio_read(src, dst, cnt) - unsigned short src; - unsigned char *dst; - unsigned short cnt; -{ - if (cnt & 1) cnt++; - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - outb(eth_nic_base + D8390_P0_RBCR0, cnt); - outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8); - outb(eth_nic_base + D8390_P0_RSAR0, src); - outb(eth_nic_base + D8390_P0_RSAR1, src>>8); - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD0 | - D8390_COMMAND_STA); - if (eth_flags & FLAG_16BIT) { - while (cnt) { - *((unsigned short *)dst) = inw(eth_asic_base + NE_DATA); - dst += 2; - cnt -= 2; - } - } - else { - while (cnt--) - *(dst++) = inb(eth_asic_base + NE_DATA); - } -} - -/************************************************************************** -ETH_PIO_WRITE - Write a frame via Programmed I/O -**************************************************************************/ -eth_pio_write(src, dst, cnt) - unsigned char *src; - unsigned short dst; - unsigned short cnt; -{ - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD2 | - D8390_COMMAND_STA); - outb(eth_nic_base + D8390_P0_ISR, D8390_ISR_RDC); - outb(eth_nic_base + D8390_P0_RBCR0, cnt); - outb(eth_nic_base + D8390_P0_RBCR1, cnt>>8); - outb(eth_nic_base + D8390_P0_RSAR0, dst); - outb(eth_nic_base + D8390_P0_RSAR1, dst>>8); - outb(eth_nic_base + D8390_P0_COMMAND, D8390_COMMAND_RD1 | - D8390_COMMAND_STA); - if (eth_flags & FLAG_16BIT) { - if (cnt & 1) cnt++; /* Round up */ - while (cnt) { - outw(eth_asic_base + NE_DATA, *((unsigned short *)src)); - src += 2; - cnt -= 2; - } - } - else { - while (cnt--) - outb(eth_asic_base + NE_DATA, *(src++)); - } - cnt = 200; - while((inb(eth_nic_base + D8390_P0_ISR) & D8390_ISR_RDC) - != D8390_ISR_RDC && --cnt); -} -#else -/************************************************************************** -ETH_PIO_READ - Dummy routine when NE2000 not compiled in -**************************************************************************/ -eth_pio_read() {} -#endif diff --git a/sys/pc98/boot/netboot/ns8390.h b/sys/pc98/boot/netboot/ns8390.h deleted file mode 100644 index ea60908660bf..000000000000 --- a/sys/pc98/boot/netboot/ns8390.h +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************** -NETBOOT - BOOTP/TFTP Bootstrap Program - -Author: Martin Renters - Date: Jun/94 - -**************************************************************************/ - -#define MEM_8192 32 -#define MEM_16384 64 -#define MEM_32768 128 - -/************************************************************************** -Western Digital/SMC Board Definitions -**************************************************************************/ -#define WD_LOW_BASE 0x200 -#define WD_HIGH_BASE 0x3e0 -#ifndef WD_DEFAULT_MEM -#define WD_DEFAULT_MEM 0xD0000 -#endif -#define WD_NIC_ADDR 0x10 - -/************************************************************************** -Western Digital/SMC ASIC Addresses -**************************************************************************/ -#define WD_MSR 0x00 -#define WD_ICR 0x01 -#define WD_IAR 0x02 -#define WD_BIO 0x03 -#define WD_IRR 0x04 -#define WD_LAAR 0x05 -#define WD_IJR 0x06 -#define WD_GP2 0x07 -#define WD_LAR 0x08 -#define WD_BID 0x0E - -#define WD_ICR_16BIT 0x01 - -#define WD_MSR_MENB 0x40 - -#define WD_LAAR_L16EN 0x40 -#define WD_LAAR_M16EN 0x80 - -#define WD_SOFTCONFIG 0x20 - -/************************************************************************** -Western Digital/SMC Board Types -**************************************************************************/ -#define TYPE_WD8003S 0x02 -#define TYPE_WD8003E 0x03 -#define TYPE_WD8013EBT 0x05 -#define TYPE_WD8003W 0x24 -#define TYPE_WD8003EB 0x25 -#define TYPE_WD8013W 0x26 -#define TYPE_WD8013EP 0x27 -#define TYPE_WD8013WC 0x28 -#define TYPE_WD8013EPC 0x29 -#define TYPE_SMC8216T 0x2a -#define TYPE_SMC8216C 0x2b -#define TYPE_SMC8416T 0x00 /* Bogus entries: the 8416 generates the */ -#define TYPE_SMC8416C 0x00 /* the same codes as the 8216. */ -#define TYPE_SMC8013EBP 0x2c - -#ifdef INCLUDE_WD -struct wd_board { - char *name; - char id; - char flags; - char memsize; -} wd_boards[] = { - {"WD8003S", TYPE_WD8003S, 0, MEM_8192}, - {"WD8003E", TYPE_WD8003E, 0, MEM_8192}, - {"WD8013EBT", TYPE_WD8013EBT, FLAG_16BIT, MEM_16384}, - {"WD8003W", TYPE_WD8003W, 0, MEM_8192}, - {"WD8003EB", TYPE_WD8003EB, 0, MEM_8192}, - {"WD8013W", TYPE_WD8013W, FLAG_16BIT, MEM_16384}, - {"WD8003EP/WD8013EP", - TYPE_WD8013EP, 0, MEM_8192}, - {"WD8013WC", TYPE_WD8013WC, FLAG_16BIT, MEM_16384}, - {"WD8013EPC", TYPE_WD8013EPC, FLAG_16BIT, MEM_16384}, - {"SMC8216T", TYPE_SMC8216T, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8216C", TYPE_SMC8216C, FLAG_16BIT | FLAG_790, MEM_16384}, - {"SMC8416T", TYPE_SMC8416T, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8416C/BT", TYPE_SMC8416C, FLAG_16BIT | FLAG_790, MEM_8192}, - {"SMC8013EBP", TYPE_SMC8013EBP,FLAG_16BIT, MEM_16384}, - {NULL, 0, 0} -}; -#endif -/************************************************************************** -3com 3c503 definitions -**************************************************************************/ - -#ifndef _3COM_BASE -#define _3COM_BASE 0x300 -#endif - -#define _3COM_TX_PAGE_OFFSET_8BIT 0x20 -#define _3COM_TX_PAGE_OFFSET_16BIT 0x0 -#define _3COM_RX_PAGE_OFFSET_16BIT 0x20 - -#define _3COM_ASIC_OFFSET 0x400 -#define _3COM_NIC_OFFSET 0x0 - -#define _3COM_PSTR 0 -#define _3COM_PSPR 1 - -#define _3COM_BCFR 3 -#define _3COM_BCFR_2E0 0x01 -#define _3COM_BCFR_2A0 0x02 -#define _3COM_BCFR_280 0x04 -#define _3COM_BCFR_250 0x08 -#define _3COM_BCFR_350 0x10 -#define _3COM_BCFR_330 0x20 -#define _3COM_BCFR_310 0x40 -#define _3COM_BCFR_300 0x80 -#define _3COM_PCFR 4 -#define _3COM_PCFR_C8000 0x10 -#define _3COM_PCFR_CC000 0x20 -#define _3COM_PCFR_D8000 0x40 -#define _3COM_PCFR_DC000 0x80 -#define _3COM_CR 6 -#define _3COM_CR_RST 0x01 /* Reset GA and NIC */ -#define _3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */ -#define _3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */ -#define _3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */ -#define _3COM_CR_SHARE 0x10 /* select interrupt sharing option */ -#define _3COM_CR_DBSEL 0x20 /* Double buffer select */ -#define _3COM_CR_DDIR 0x40 /* DMA direction select */ -#define _3COM_CR_START 0x80 /* Start DMA controller */ -#define _3COM_GACFR 5 -#define _3COM_GACFR_MBS0 0x01 -#define _3COM_GACFR_MBS1 0x02 -#define _3COM_GACFR_MBS2 0x04 -#define _3COM_GACFR_RSEL 0x08 /* enable shared memory */ -#define _3COM_GACFR_TEST 0x10 /* for GA testing */ -#define _3COM_GACFR_OWS 0x20 /* select 0WS access to GA */ -#define _3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */ -#define _3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */ -#define _3COM_STREG 7 -#define _3COM_STREG_REV 0x07 /* GA revision */ -#define _3COM_STREG_DIP 0x08 /* DMA in progress */ -#define _3COM_STREG_DTC 0x10 /* DMA terminal count */ -#define _3COM_STREG_OFLW 0x20 /* Overflow */ -#define _3COM_STREG_UFLW 0x40 /* Underflow */ -#define _3COM_STREG_DPRDY 0x80 /* Data port ready */ -#define _3COM_IDCFR 8 -#define _3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */ -#define _3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */ -#define _3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */ -#define _3COM_IDCFR_UNUSED 0x08 /* not used */ -#define _3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */ -#define _3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */ -#define _3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */ -#define _3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */ -#define _3COM_IRQ2 2 -#define _3COM_IRQ3 3 -#define _3COM_IRQ4 4 -#define _3COM_IRQ5 5 -#define _3COM_DAMSB 9 -#define _3COM_DALSB 0x0a -#define _3COM_VPTR2 0x0b -#define _3COM_VPTR1 0x0c -#define _3COM_VPTR0 0x0d -#define _3COM_RFMSB 0x0e -#define _3COM_RFLSB 0x0f - -/************************************************************************** -NE1000/2000 definitions -**************************************************************************/ -#ifndef NE_BASE -#define NE_BASE 0x320 -#endif -#ifdef PC98 -#define NE_ASIC_OFFSET 0x00 -#define NE_RESET 0x300 /* Used to reset card */ -#define NE_DATA 0x200 /* Used to read/write NIC mem */ -#else -#define NE_ASIC_OFFSET 0x10 -#define NE_RESET 0x0F /* Used to reset card */ -#define NE_DATA 0x00 /* Used to read/write NIC mem */ -#endif - -/************************************************************************** -8390 Register Definitions -**************************************************************************/ -#if !defined(PC98) || defined(INCLUDE_LGY) -#define D8390_P0_COMMAND 0x00 -#define D8390_P0_PSTART 0x01 -#define D8390_P0_PSTOP 0x02 -#define D8390_P0_BOUND 0x03 -#define D8390_P0_TSR 0x04 -#define D8390_P0_TPSR 0x04 -#define D8390_P0_TBCR0 0x05 -#define D8390_P0_TBCR1 0x06 -#define D8390_P0_ISR 0x07 -#define D8390_P0_RSAR0 0x08 -#define D8390_P0_RSAR1 0x09 -#define D8390_P0_RBCR0 0x0A -#define D8390_P0_RBCR1 0x0B -#define D8390_P0_RSR 0x0C -#define D8390_P0_RCR 0x0C -#define D8390_P0_TCR 0x0D -#define D8390_P0_DCR 0x0E -#define D8390_P0_IMR 0x0F -#define D8390_P1_COMMAND 0x00 -#define D8390_P1_PAR0 0x01 -#define D8390_P1_PAR1 0x02 -#define D8390_P1_PAR2 0x03 -#define D8390_P1_PAR3 0x04 -#define D8390_P1_PAR4 0x05 -#define D8390_P1_PAR5 0x06 -#define D8390_P1_CURR 0x07 -#define D8390_P1_MAR0 0x08 -#endif -#ifdef PC98 -#define TYPE98_LGY 0x10 -#define TYPE98_EGY 0x11 -#define TYPE98_ICM 0x12 -#endif -#ifdef INCLUDE_EGY -#define D8390_P0_COMMAND 0x00 -#define D8390_P0_PSTART 0x02 -#define D8390_P0_PSTOP 0x04 -#define D8390_P0_BOUND 0x06 -#define D8390_P0_TSR 0x08 -#define D8390_P0_TPSR 0x08 -#define D8390_P0_TBCR0 0x0a -#define D8390_P0_TBCR1 0x0c -#define D8390_P0_ISR 0x0e -#define D8390_P0_RSAR0 0x100 -#define D8390_P0_RSAR1 0x102 -#define D8390_P0_RBCR0 0x104 -#define D8390_P0_RBCR1 0x106 -#define D8390_P0_RSR 0x108 -#define D8390_P0_RCR 0x108 -#define D8390_P0_TCR 0x10a -#define D8390_P0_DCR 0x10c -#define D8390_P0_IMR 0x10e -#define D8390_P1_COMMAND 0x00 -#define D8390_P1_PAR0 0x02 -#define D8390_P1_PAR1 0x04 -#define D8390_P1_PAR2 0x06 -#define D8390_P1_PAR3 0x08 -#define D8390_P1_PAR4 0x0a -#define D8390_P1_PAR5 0x0c -#define D8390_P1_CURR 0x0e -#define D8390_P1_MAR0 0x100 -#endif - -#define D8390_COMMAND_PS0 0x0 /* Page 0 select */ -#define D8390_COMMAND_PS1 0x40 /* Page 1 select */ -#define D8390_COMMAND_PS2 0x80 /* Page 2 select */ -#define D8390_COMMAND_RD2 0x20 /* Remote DMA control */ -#define D8390_COMMAND_RD1 0x10 -#define D8390_COMMAND_RD0 0x08 -#define D8390_COMMAND_TXP 0x04 /* transmit packet */ -#define D8390_COMMAND_STA 0x02 /* start */ -#define D8390_COMMAND_STP 0x01 /* stop */ - -#define D8390_RCR_MON 0x20 /* monitor mode */ - -#define D8390_DCR_FT1 0x40 -#define D8390_DCR_LS 0x08 /* Loopback select */ -#define D8390_DCR_WTS 0x01 /* Word transfer select */ - -#define D8390_ISR_PRX 0x01 /* successful recv */ -#define D8390_ISR_PTX 0x02 /* successful xmit */ -#define D8390_ISR_RXE 0x04 /* receive error */ -#define D8390_ISR_TXE 0x08 /* transmit error */ -#define D8390_ISR_OVW 0x10 /* Overflow */ -#define D8390_ISR_CNT 0x20 /* Counter overflow */ -#define D8390_ISR_RDC 0x40 /* Remote DMA complete */ -#define D8390_ISR_RST 0x80 /* reset */ - -#define D8390_RSTAT_PRX 0x01 /* successful recv */ -#define D8390_RSTAT_CRC 0x02 /* CRC error */ -#define D8390_RSTAT_FAE 0x04 /* Frame alignment error */ -#define D8390_RSTAT_OVER 0x08 /* overflow */ - -#define D8390_TXBUF_SIZE 6 -#define D8390_RXBUF_END 32 -#define D8390_PAGE_SIZE 256 - -struct ringbuffer { - unsigned char status; - unsigned char bound; - unsigned short len; -}; diff --git a/sys/pc98/boot/netboot/rpc.c b/sys/pc98/boot/netboot/rpc.c deleted file mode 100644 index e173013c1d82..000000000000 --- a/sys/pc98/boot/netboot/rpc.c +++ /dev/null @@ -1,190 +0,0 @@ -/*********************************************************************** - -Remote Procedure Call Support Routines - -Author: Martin Renters - Date: Oct/1994 - -***********************************************************************/ - -#include "netboot.h" - -int rpc_id; -extern char packet[]; -extern struct nfs_diskless nfsdiskless; -extern int hostnamelen; -/*************************************************************************** - -RPCLOOKUP: Lookup RPC Port numbers - -***************************************************************************/ -rpclookup(addr, prog, ver) - int addr, prog, ver; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%L%L%L%L%L", - rpc_id, MSG_CALL, 2, PROG_PORTMAP, 2, PORTMAP_LOOKUP, - 0, 0, 0, 0, prog, ver, IP_UDP, 0); - while(retries--) { - udp_transmit(arptable[addr].ipaddr, RPC_SOCKET, - SUNRPC, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus == rpc->u.reply.verifier == - rpc->u.reply.astatus == 0) - return(ntohl(rpc->u.reply.data[0])); - else { - rpc_err(rpc); - return(-1); - } - } - } - return(-1); -} - -/*************************************************************************** - -NFS_MOUNT: Mount an NFS Filesystem - -***************************************************************************/ -nfs_mount(server, port, path, fh) - int server; - int port; - char *path; - char *fh; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%S", - rpc_id, MSG_CALL, 2, PROG_MOUNT, 1, MOUNT_ADDENTRY, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - path); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - bcopy(&rpc->u.reply.data[1],fh, 32); - return(0); - } - } - } - return(-1); -} - - -/*************************************************************************** - -NFS_LOOKUP: Lookup Pathname - -***************************************************************************/ -nfs_lookup(server, port, fh, path, file_fh, sizep) - int server; - int port; - char *fh; - char *path; - char *file_fh; - int *sizep; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - rpcptr = sprintf(&buf.u.data,"%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%M%S", - rpc_id, MSG_CALL, 2, PROG_NFS, 2, NFS_LOOKUP, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - 32, fh, path); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - bcopy(&rpc->u.reply.data[1],file_fh, 32); - if (sizep) - *sizep = ntohl(rpc->u.reply.data[14]); - return(0); - } - } - } - return(-1); -} - -/*************************************************************************** - -NFS_READ: Read File - -***************************************************************************/ -nfs_read(server, port, fh, offset, len, buffer) - int server; - int port; - char *fh; - int offset, len; - char *buffer; -{ - struct rpc_t buf, *rpc; - char *rpcptr; - int retries = MAX_RPC_RETRIES; - int rlen; - rpcptr = sprintf(&buf.u.data, - "%L%L%L%L%L%L%L%L%L%S%L%L%L%L%L%L%L%M%L%L%L", - rpc_id, MSG_CALL, 2, PROG_NFS, 2, NFS_READ, - 1, hostnamelen + 28,0,&nfsdiskless.my_hostnam,0,0,2,0,0,0,0, - 32, fh, offset, len, 0); - while(retries--) { - udp_transmit(arptable[server].ipaddr, RPC_SOCKET, - port, rpcptr - (char *)&buf, &buf); - if (await_reply(AWAIT_RPC, rpc_id, NULL)) { - rpc = (struct rpc_t *)&packet[ETHER_HDR_LEN]; - if (rpc->u.reply.rstatus || rpc->u.reply.verifier || - rpc->u.reply.astatus || rpc->u.reply.data[0]) { - rpc_err(rpc); - return(-(ntohl(rpc->u.reply.data[0]))); - } else { - rlen = ntohl(rpc->u.reply.data[18]); - if (len < rlen) rlen = len; - if (len > rlen) printf("short read\n"); - bcopy(&rpc->u.reply.data[19], buffer, rlen); - return(rlen); - } - } - } - return(-1); -} - -/*************************************************************************** - -RPC_ERR - Print RPC Errors - -***************************************************************************/ -rpc_err(rpc) - struct rpc_t *rpc; -{ - int err = ntohl(rpc->u.reply.data[0]); - printf("***RPC Error: (%d,%d,%d):\n ", - ntohl(rpc->u.reply.rstatus), - ntohl(rpc->u.reply.verifier), - ntohl(rpc->u.reply.astatus)); -} - -nfs_err(err) - int err; -{ - err = -err; - if (err == NFSERR_PERM) printf("Not owner"); - else if (err == NFSERR_NOENT) printf("No such file or directory"); - else if (err == NFSERR_ACCES) printf("Permission denied"); - else printf("Error %d",err); - printf("\n"); -} diff --git a/sys/pc98/boot/netboot/start2.S b/sys/pc98/boot/netboot/start2.S deleted file mode 100644 index 7530e1d4bb6b..000000000000 --- a/sys/pc98/boot/netboot/start2.S +++ /dev/null @@ -1,722 +0,0 @@ - -#define STACKADDR 0xe000 /* Needs to be end of bss + stacksize */ -#define KERN_CODE_SEG 0x08 -#define KERN_DATA_SEG 0x10 -#define REAL_MODE_CSEG 0x18 -#define REAL_MODE_DSEG 0x20 -#define CR0_PE 1 - -#define opsize .byte 0x66 -#define addrsize .byte 0x67 - -/* At entry, the processor is in 16 bit real mode and the code is being - * executed from an address it was not linked to. Code must be pic and - * 32 bit sensitive until things are fixed up. - */ -#ifdef BOOTROM -#ifndef PC98 - .word 0xaa55 /* bios extension signature */ - .byte (ROMSIZE>>9) /* no. of 512B blocks */ - jmp 1f /* enter from bios here */ - .byte 0 /* checksum */ -#ifdef PCI - .ascii "FreeBSD boot ROM.." /* 18 bytes total */ - .word 0x1a -/* PCI rom data structure format */ - .ascii "PCIR" /* signature */ - .word PCI_VENDOR /* vendor ID */ - .word PCI_DEVICE /* device ID */ - .word 0 /* vital product data */ - .word 0x0018 /* PCI data structure */ - .byte 0 /* PCI data struct. rev -- 0 */ - .byte PCI_CLASS /* Class code */ - .word (ROMSIZE>>9) /* no. of 512B blocks */ - .byte 0,0 /* rev. level */ - .byte 0 /* code type - 0 =x86 */ - .byte 0x80 /* indicator of last block */ - .word 0 /* reserved */ -#endif -1: push %eax - push %ds - xor %eax,%eax - mov %ax,%ds - .byte 0xa1 /* MOV 0x304,%ax */ - .word 0x304 - .byte 0x3d /* CMP $0x4d52, %ax == 'MR' */ - .word 0x4d52 - jz 2f - .byte 0xa1 /* MOV 0x64, %ax */ - .word 0x64 - .byte 0xa3 /* MOV %ax, 0x300 */ - .word 0x300 - .byte 0xa1 /* MOV 0x66, %ax */ - .word 0x66 - .byte 0xa3 /* MOV %ax, 0x302 */ - .word 0x302 - .byte 0xb8 /* MOV $_start-RELOCADDR, %ax */ - .word (_start-RELOC) - .byte 0xa3 /* MOV %ax, 0x64 */ - .word 0x64 - mov %cs,%ax - .byte 0xa3 /* MOV %ax, 0x66 */ - .word 0x66 - .byte 0xb8 /* MOV 'MR',%ax */ - .word 0x4d52 - .byte 0xa3 /* MOV %ax, 0x304 */ - .word 0x304 -2: pop %ds - pop %eax - lret -#else /* defined PC98 */ - .byte 0xcb /* 00 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 03 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 06 retf */ - .byte 0x00 - .byte 0x00 - .byte 0x55 /* 09 MAGIC */ - .byte 0xaa - .byte 0x00 - .byte 0xeb /* 0c jmp 1f */ - .byte 0x22 - .byte 0x00 - .byte 0xcb /* 0f retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 12 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 15 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 18 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 1b retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 1e retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 21 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 24 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 27 retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 2a retf */ - .byte 0x00 - .byte 0x00 - .byte 0xcb /* 2d retf */ - .byte 0x00 - .byte 0x00 -1: - cli - pusha - opsize - mov $0x1fc0, %eax - mov %ax, %es - mov %esp, %eax - addrsize - .byte 0x26 /* es: */ - mov %eax, (0x0000) - mov %ss, %ax - addrsize - .byte 0x26 /* es: */ - mov %eax, (0x0004) -#endif -#endif - -/************************************************************************** -START - Where all the fun begins.... -**************************************************************************/ - .globl _start -_start: - cli - cld -#ifdef BOOTROM /* relocate ourselves */ - xor %esi, %esi /* zero for ROMs */ -#else - .byte 0xbe /* MOV $0x100,%si -- 100h for .COM */ - .word 0x100 -#endif - xor %edi,%edi - .byte 0xb8 /* MOV $RELOCADDR>>4, %ax */ - .word (RELOC>>4) - mov %ax, %es - .byte 0xb9 /* MOV $ROMSIZE, %cx */ - .word ROMSIZE - cs - rep - movsb - opsize - ljmp $(RELOC>>4),$1f-RELOC /* Jmp to RELOC:1f */ -1: - nop -#ifdef PC98 - opsize - mov $0x0a00, %eax /* 80 x 25 mode */ - int $0x18 - movb $0x0c, %ah /* text on */ - int $0x18 - movb $0x16, %ah /* t-vram clear */ - opsize - mov $0xe100, %edx - int $0x18 - - /* cursor home and on */ - xor %edx, %edx - movb $0x13, %ah - int $0x18 - movb $0x11, %ah - int $0x18 - - /* set up %ds */ - xor %ax, %ax - mov %ax, %ds - - opsize - mov $0xa000, %eax - mov %ax, %es - - /* transfer PC-9801 system common area to 0xa1000 */ - opsize - mov $0x0000, %esi - opsize - mov $0x1000, %edi - opsize - mov $0x0630, %ecx - cld - rep - movsb - - /* transfer EPSON machine type to 0xa1200 */ - push %ds - opsize - mov $0xfd00, %eax - mov %ax, %ds - addrsize - opsize - mov 0x804, %eax - opsize - and $0x00ffffff, %eax - addrsize - opsize - .byte 0x26 - mov %eax, %es: (0x1624) - pop %ds -#endif - mov %cs,%ax - mov %ax,%ds - mov %ax,%es - mov %ax,%ss - .byte 0xb8 /* MOV $STACKADDR, %ax */ - .word STACKADDR - mov %eax,%esp - opsize - call _real_to_prot - call _main - .globl _exit -_exit: - call _prot_to_real -#ifndef PC98 -#ifdef BOOTROM - xor %eax,%eax - mov %ax,%ds - .byte 0xa1 /* MOV 0x302, %ax */ - .word 0x302 - push %eax - .byte 0xa1 /* MOV 0x300, %ax */ - .word 0x300 - push %eax - lret -#else - int $0x19 -#endif -#else /* defined PC98 */ -#ifdef BOOTROM - cli - movb $0x0e, %al /* CPU RESET */ - outb %al, $0x37 - xor %eax, %eax - mov %ax, %es - push %cs - push $2f - addrsize - .byte 0x26 /* es: */ - mov %esp, (0x0404) - addrsize - .byte 0x26 /* es: */ - movw %ss, (0x0406) - movb $0x00, %al - outb %al, $0xf0 -1: - jmp 1b -2: - movb $0x0f, %al - outb %al, $0x37 - - opsize /* restore ss:sp */ - mov $0x1fc0, %eax - mov %ax, %es - addrsize - .byte 0x26 /* es: */ - mov (0x0000), %ebx - addrsize - .byte 0x26 /* es: */ - mov (0x0004), %eax - mov %ax, %ss - mov %ebx, %esp - sti - popa - lret -#else - mov $0x8000, %ecx - movb $0x00, %al -1: - jmp 1b - outb %al, $0x5f - loop 1b - outb %al, $0xf0 -1: - jmp 1b -#endif -#endif - -#ifndef PC98 -/************************************************************************** -CURRTICKS - Get Time -**************************************************************************/ - .globl _currticks -_currticks: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - xor %edx,%edx - call _prot_to_real - xor %eax,%eax - int $0x1a - opsize - call _real_to_prot - xor %eax,%eax - shl $16,%ecx - mov %edx,%eax - or %ecx,%eax - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -PUTCHAR - Print a character -**************************************************************************/ - .globl _putchar -_putchar: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - movb 8(%ebp),%cl - call _prot_to_real - opsize - mov $1,%ebx - movb $0x0e,%ah - movb %cl,%al - int $0x10 - opsize - call _real_to_prot - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -GETCHAR - Get a character -**************************************************************************/ - .globl _getchar -_getchar: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - call _prot_to_real - movb $0x0,%ah - int $0x16 - movb %al,%bl - opsize - call _real_to_prot - xor %eax,%eax - movb %bl,%al - pop %edi - pop %esi - pop %ebx - pop %ebp - ret - -/************************************************************************** -ISKEY - Check for keyboard interrupt -**************************************************************************/ - .globl _iskey -_iskey: - push %ebp - mov %esp,%ebp - push %ebx - push %esi - push %edi - call _prot_to_real - xor %ebx,%ebx - movb $0x1,%ah - int $0x16 - opsize - jz 1f - movb %al,%bl -1: - opsize - call _real_to_prot - xor %eax,%eax - movb %bl,%al - pop %edi - pop %esi - pop %ebx - pop %ebp - ret -#else /* defined PC98 */ -/************************************************************************** -Get Date & Time -**************************************************************************/ - .globl _bios98getdate -_bios98getdate: - push %ebp - mov %esp,%ebp - push %ebx - push %es - - call _prot_to_real - - opsize - mov $0x1ff0, %eax - mov %ax, %es - movb $0x00, %ah - opsize - mov $0x80, %ebx /* bios uses 1ff0:0080 */ - int $0x1c - - opsize - mov $0x82, %ebx - opsize - .byte 0x26 /* es: */ - .byte 0x8b /* mov (%ebx), %ebx */ - .byte 0x1f - - opsize - call _real_to_prot - - mov %ebx, %eax - pop %es - pop %ebx - pop %ebp - ret - -/* - * getc() - * BIOS call "INT 18H Function 00H" to read character from keyboard - * Call with %ah = 0x0 - * Return: %ah = keyboard scan code - * %al = ASCII character - */ - - .globl _getchar -_getchar: - push %ebp - mov %esp, %ebp - push %ebx /* save %ebx */ - - call _prot_to_real - - movb $0x0, %ah - int $0x18 - - movb %al, %bl /* real_to_prot uses %eax */ - - opsize - call _real_to_prot - - xor %eax, %eax - movb %bl, %al - - pop %ebx - pop %ebp - ret -/* - * ischar() - * if there is a character pending, return it; otherwise return 0 - * BIOS call "INT 18H Function 01H" to check whether a character is pending - * Call with %ah = 0x1 - * Return: - * If key waiting to be input: - * %ah = keyboard scan code - * %al = ASCII character - * %bh = 1 - * else - * %bh = 0 - */ - .globl _iskey -_iskey: - push %ebp - mov %esp, %ebp - push %ebx - - call _prot_to_real /* enter real mode */ - - xor %ebx, %ebx - movb $0x1, %ah - int $0x18 - andb %bh, %bh - opsize - jz nochar - movb %al, %bl - -nochar: - opsize - call _real_to_prot - - xor %eax, %eax - movb %bl, %al - - pop %ebx - pop %ebp - ret - -#endif - - -/* - * C library -- _setjmp, _longjmp - * - * longjmp(a,v) - * will generate a "return(v)" from the last call to - * setjmp(a) - * by restoring registers from the stack. - * The previous signal state is restored. - */ - - .globl _setjmp -_setjmp: - movl 4(%esp),%ecx - movl 0(%esp),%edx - movl %edx, 0(%ecx) - movl %ebx, 4(%ecx) - movl %esp, 8(%ecx) - movl %ebp,12(%ecx) - movl %esi,16(%ecx) - movl %edi,20(%ecx) - movl %eax,24(%ecx) - movl $0,%eax - ret - - .globl _longjmp -_longjmp: - movl 4(%esp),%edx - movl 8(%esp),%eax - movl 0(%edx),%ecx - movl 4(%edx),%ebx - movl 8(%edx),%esp - movl 12(%edx),%ebp - movl 16(%edx),%esi - movl 20(%edx),%edi - cmpl $0,%eax - jne 1f - movl $1,%eax -1: movl %ecx,0(%esp) - ret - -/************************************************************************** -___MAIN - Dummy to keep GCC happy -**************************************************************************/ - .globl ___main -___main: - ret - -/************************************************************************** -REAL_TO_PROT - Go from REAL mode to Protected Mode -**************************************************************************/ - .globl _real_to_prot -_real_to_prot: - cli - cs - addrsize - lgdt gdtarg-RELOC - mov %cr0, %eax - opsize - or $CR0_PE, %eax - mov %eax, %cr0 /* turn on protected mode */ - - /* jump to relocation, flush prefetch queue, and reload %cs */ - opsize - ljmp $KERN_CODE_SEG, $1f -1: - /* reload other segment registers */ - movl $KERN_DATA_SEG, %eax - movl %ax, %ds - movl %ax, %es - movl %ax, %ss - add $RELOC,%esp /* Fix up stack pointer */ - pop %eax /* Fix up return Address */ - add $RELOC,%eax - push %eax - ret - - -/************************************************************************** -PROT_TO_REAL - Go from Protected Mode to REAL Mode -**************************************************************************/ - .globl _prot_to_real -_prot_to_real: - pop %eax - sub $RELOC,%eax /* Adjust return address */ - push %eax - sub $RELOC,%esp /* Adjust stack pointer */ - - /* Prepare %ax while we're still in a mode that gas understands. */ - movw $REAL_MODE_DSEG, %ax - - ljmp $REAL_MODE_CSEG, $1f-RELOC /* jump to a 16 bit segment */ -1: - mov %ax, %ds - mov %ax, %ss - mov %ax, %es - mov %ax, %fs - - /* clear the PE bit of CR0 */ - mov %cr0, %eax - opsize - andl $0!CR0_PE, %eax - mov %eax, %cr0 - - /* make intersegment jmp to flush the processor pipeline - * and reload CS register - */ - opsize - ljmp $(RELOC)>>4, $2f-RELOC -2: - /* we are in real mode now - * set up the real mode segment registers : DS, SS, ES - */ - mov %cs, %ax - mov %ax, %ds - mov %ax, %es - mov %ax, %ss - sti - opsize - ret - -/************************************************************************** -GET DISK GEOMETRY INFO -**************************************************************************/ -#ifdef PC98 -/* - * - * get_diskinfo(): return a word that represents the - * max number of sectors and heads and drives for this device - * - */ - .globl _get_diskinfo -_get_diskinfo: - push %ebp - mov %esp, %ebp - push %ebx - push %esi - push %edi - - movb 0x8(%ebp), %dl /* diskinfo(drive #) */ - call _prot_to_real /* enter real mode */ - - movb %dl, %al /* ask for disk info */ - andb $0xf0, %al - cmpb $0x90, %al - jz fdd - - movb %dl, %al - movb $0x84, %ah - - int $0x1b - - jnc ok - /* - * Urk. Call failed. It is not supported for floppies by old BIOS's. - * Guess it's a 15-sector floppy. - */ -fdd: - subb %ah, %ah /* %ax = 0 */ - movb %al, %al - movb %ah, %bh /* %bh = 0 */ - movb $2, %bl /* %bl bits 0-3 = drive type, - bit 2 = 1.2M */ - movb $79, %ch /* max track */ - movb $1, %cl /* # floppy drives installed */ - movb $2, %dh /* max head */ - movb $15, %dl /* max sector */ - /* es:di = parameter table */ - /* carry = 0 */ -ok: - - opsize - call _real_to_prot /* back to protected mode */ - - /* - * form a longword representing all this gunk: - * 16 bit cylinder - * 8 bit head - * 8 bit sector - */ - mov %ecx, %eax - sall $16,%eax /* << 16 */ - movb %dh, %ah /* max head */ - movb %dl, %al /* max sector (and # sectors) */ - - pop %edi - pop %esi - pop %ebx - pop %ebp - ret -#endif -/************************************************************************** -GLOBAL DESCRIPTOR TABLE -**************************************************************************/ - .align 4 -gdt: - .word 0, 0 - .byte 0, 0x00, 0x00, 0 - - /* code segment */ - .word 0xffff, 0 - .byte 0, 0x9f, 0xcf, 0 - - /* data segment */ - .word 0xffff, 0 - .byte 0, 0x93, 0xcf, 0 - - /* 16 bit real mode code segment */ - .word 0xffff, RELOC & 0xffff - .byte (RELOC>>16), 0x9b, 0x00, (RELOC>>24) - - /* 16 bit real mode data segment */ - .word 0xffff, RELOC & 0xffff - .byte (RELOC>>16), 0x93, 0x00, (RELOC>>24) - - .align 4 -gdtarg: - .word 0x27 /* limit */ - .long gdt /* addr */ diff --git a/sys/pc98/boot/rawboot/Makefile b/sys/pc98/boot/rawboot/Makefile deleted file mode 100644 index be5f4cab8f79..000000000000 --- a/sys/pc98/boot/rawboot/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# $FreeBSD$ -# - -PROG= boot - -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c disk.c sys.c - -.PATH: ${.CURDIR}/../biosboot - -BINMODE= 444 -CFLAGS= -O2 -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ - -DPC98 \ - -DRAWBOOT \ - -I${.CURDIR}/../biosboot \ - -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= ${CWARNFLAGS} - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -BOOT_COMCONSOLE_PORT?=0x30 -BOOT_COMCONSOLE_CLK?=16 -BOOT_COMCONSOLE_MODE=0x0c -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \ - -DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \ - -DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE} - -# feature not implemented -# BOOT_COMCONSOLE_SPEED?=9600 -# CFLAGS+= -DCONSPEED=${BOOT_COMCONSOLE_SPEED} - -# 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 -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:sd(0,a) instead of -# 1:wd(1,a). If `sd' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (sd_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes sd(0,a) correspond to 1:sd(0,a) instead of 0:sd(0,a). - -CLEANFILES+= boot.nohdr boot.strip rawboot sizetest -LDFLAGS+= -N -T 0 -nostdlib -NOSHARED= YES -NOMAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.strip: boot - cp -p boot boot.strip - strip -aout boot.strip - size -aout boot.strip - -boot.nohdr: boot.strip - dd if=boot.strip of=boot.nohdr ibs=32 skip=1 obs=1024b - ls -l boot.nohdr - -rawboot: boot.nohdr - dd if=boot.nohdr of=rawboot bs=8k count=1 conv=sync - -all: rawboot - -install: - ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}\ - rawboot ${DESTDIR}${BINDIR}/rawboot - -.include <bsd.kern.mk> -.include <bsd.prog.mk> diff --git a/sys/pc98/boot/rawboot/README b/sys/pc98/boot/rawboot/README deleted file mode 100644 index 4cf51f0c60ad..000000000000 --- a/sys/pc98/boot/rawboot/README +++ /dev/null @@ -1,17 +0,0 @@ -RAWboot readme. - -This is a dumber version of the code in biosboot. - -The intended usage is: - - cat /usr/mdec/rawboot /sys/compile/FOO/kernel | fdwrite - -This makes it a lot easier to make a bootable floppy, and saves space -on the floppy to boot. - -Of course the name you enter for the kernel isn't used... Then again -if you know how to make two kernels fit a floppy and have a use for -it, you don't need this bootblock. - -Poul-Henning Kamp -phk@FreeBSD.org |
