diff --git a/sys/arch/amiga/AMIGA-MMU b/sys/arch/amiga/AMIGA-MMU new file mode 100644 index 000000000000..a7fe635ce22a --- /dev/null +++ b/sys/arch/amiga/AMIGA-MMU @@ -0,0 +1,25 @@ +The HP300 version uses a kernel which is loaded into the range 0xfffxxx... but +is linked for range 0x000.. This causes the problem that with switching the +MMU to the mapped kernel, the PC becomes invalid. The HP version solves the +problem by mapping 1:1 the last page of physical memory into virtual memory. + +On the Amiga, there *is* memory at PA 0x0, so we might as well use it, causes +much less grief and weirdness in locore.s. However, since memory down there +is CHIPMEM, inherently slower than FASTMEM, and badly needed for framebuffer +storage space, we'll copy the kernel over to the first bank of FASTRAM, and +when enabling the MMU, the kernel will execute in FASTRAM, although the PC +stays the same. + +This strategy has the big advantage (compared to the solution in Amiga MACH) +that we can link the kernel absolutely to VA 0, for all memory models, since +we'll never execute the kernel in the FASTMEM space while the MMU is turned +off. + +This strategy also means, that we don't have to relocate any addresses while +bootstrapping the mmu!! + +Initialization of the MMU happens in amiga_init.c. This file is quite a mess, +I have generated it trying to understand what's happening in the hp300 locore.s +file. I think, it should be able to handle MMU initialization much cleaner +now that we don't have to think about relocation until the MMU is enabled. +If you need your daily bit of horror, take a look at amiga_init.c... diff --git a/sys/arch/amiga/BUGS b/sys/arch/amiga/BUGS new file mode 100644 index 000000000000..55e54c3e6430 --- /dev/null +++ b/sys/arch/amiga/BUGS @@ -0,0 +1,26 @@ +Current list as of 93-7-5: + +Those I'm aware of: +- nfsd and mountd crash regularly when going to multiuser mode... +- the console seems to have some problems displaying text when parity is + enabled. This shows in a distorted login-prompt (multiuser mode). +- the vt200 emulator is really far from perfect, and needs a lot more work + to be honestly called a vt200 (or vt320 even) emulator. +- the console chops the rightmost character, I guess this is a problem of + the display-window, not of the bitmap drawing itself. +- 8bit characters are all displayed as ^@. Problems could lie in wrong tty + settings or the ite driver. +- although autoconfig information is passed into the kernel and the hardware + table is generated, no I/O-space is currently allocated in kernel VM for + boards. This will probably be one of the first things to fix or nobody is + able to access their boards under BSD ... +- sun-style disklabels are not yet supported. +- disklabels can't be written back to disk. You'll have to configure your + drives under amigados (with hdtoolbox), and just format the partitions + under BSD. I think this is a tolerable limitation. +- there's currently no provision for reading the realtime-clock, so time + is always set using the last modification date of the mounted root + filesystem. +- severe crash after dumping to disk... + +to be continued... diff --git a/sys/arch/amiga/INSTALL b/sys/arch/amiga/INSTALL new file mode 100644 index 000000000000..27ed808cab1f --- /dev/null +++ b/sys/arch/amiga/INSTALL @@ -0,0 +1,121 @@ +How to install BSD on your Amiga: +-------------------------------- + +*Please* (re)read the README.amiga file, and make sure your system is +supported by the current kernel. + +Since BSD doesn't yet have a floppy driver, and you'll need a root fs +to start using commands (chicken and egg problem..) to make your own +fs, installation of the root fs is a bit hacky... + +vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +> We copy a binary image (8M) of the root fs directly to the place on < +> your harddisk. This is an extremely dangerous thing to do, since if < +> you get the offsets wrong, you'll destroy data on other partitions of < +> the drive! < +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you don't feel like risking the life of innocent data on your disk, +better stop installing now, and wait until installation gets safer in +the future!!! + + +Ok.. if you're reading on, start up hdtoolbox, and create some partitions +for use by BSD. You'll have to at least create two partitions: + +o a root partition: + Must have FileSystem: Custom File System + Identifier: 0x42534452 (`BSDR') + Reserved begin: 0 + end: 0 + Use custom boot code: NO (ie. no checkmark) + FS block size: 512 + You don't have to check Automount, the partition could only + confuse AmigaDOS. + +o a swap partition: + Must have FileSystem: Custom File System + Identifier: 0x42534453 (`BSDS') + Reserved begin: 0 + end: 0 + Use custom boot code: NO (ie. no checkmark) + FS block size: 512 + You don't have to check Automount, the partition could only + confuse AmigaDOS. + + +You might also add a /usr partition, for example on BSDD: + Must have FileSystem: Custom File System + Identifier: 0x42534444 (`BSDD') + Reserved begin: 0 + end: 0 + Use custom boot code: NO (ie. no checkmark) + FS block size: 512 + You don't have to check Automount, the partition might only + confuse AmigaDOS. + + +Other settings (like MaxTransfer and Mask) are ignored. + +Now, you'll have to find out about the exact block start address and length +in blocks of the BSDR fs (BSD will find out about the data of the other +partitions once it's started up). Go into "Change Drive Type" menu, and +write down the "Blocks per Cylinder" value it shows you for this drive. Then +go into the "Partition Drive" menu, select your BSDR partition, enable +"Advanced Options", and write down the "Start Cyl" and "End Cyl" values. + +Doing "Blocks per Cylinder" * "Start Cyl" gives you the block start number +of the BSDR partition, doing "Blocks per Cylinder" * ("End Cyl" - "Start Cyl") +results in the length of the partition in blocks. You'll need these values +to install the root fs onto the drive, so please write them down, and PLEASE +make sure you calculated them right, since if not, you'll scribble anywhere +on the drive, and that just might be.. (insert worst imaginations..). + +************************************************************************** +The rootfs has a length of ~8M, 16448 blocks. Your root fs must have at +least (!) the same amount of blocks. You don't have to make it exactly +16448 blocks though, a task that could even be impossible if the number of +blocks per cylinder on your drive is not a divisor of 16448. +************************************************************************** + +Now you're almost ready to do the installation. Unzip the distributed rootfs.gz +file (you'll need 8M of free space on your amigados partition for this!), and +then do: + + filetodev {START_NUMBER} 16448 rootfs scsi.device {UNIT} 1000 + +with: + {START_NUMBER}: above calculated block start number + {UNIT}: the scsi unit you're installing on, 0-6 + + +The filetodev program is included in the bffs11.lzh archive, and was written +by Chris Hooper (cdh@mtu.edu). + + + +How to start BSD +---------------- + +You start BSD with a loader program from AmigaDOS. This loader is called +`loadbsd', and it takes as parameter the kernel file, normally vmunix. + +So, + + loadbsd vmunix + +will (try to...) boot BSD. The kernel as distributed prefers to boot from +SCSI unit 6. It will probably boot from other units as well (can't test +this at the moment, since I don't want to repartition my other drives). If +you run into problems (ie. BSD says it can't mount the root filesystem), +you'll have to recompile the kernel. Please see the RECOMPILE file for +how to do this. + + +What about /usr ? +----------------- +For the first distribution of the kernel, I decided not to distribute +binaries for the /usr filesystem. Simply, because /usr is huge compared +to root, and a.out headers are likely to change in the future, rendering +a distributed /usr filesystem almost useless. + diff --git a/sys/arch/amiga/Makefile b/sys/arch/amiga/Makefile new file mode 100644 index 000000000000..c023007c48a6 --- /dev/null +++ b/sys/arch/amiga/Makefile @@ -0,0 +1,29 @@ +# @(#)Makefile 7.3 (Berkeley) 6/9/91 + +COMM= ../net/*.[ch] ../netimp/*.[ch] ../netinet/*.[ch] ../netns/*.[ch] \ + ../netiso/*.[ch] ../netccitt/*.[ch] \ + ../kern/*.c ../ufs/*.[ch] ../nfs/*.[ch] ../vm/*.[ch] ../sys/*.h + +# Makefile for hp300 tags file + +all: + @echo "make tags or links only" + +THP300= ../hp300/tags +SHP300= ../hp300/hp300/*.[ch] ../hp300/include/*.h \ + ../hp300/hpux/*.[ch] ../hp300/dev/*.[ch] +AHP300= ../hp300/hp300/*.s + +# Directories in which to place hp300 tags links +DHP300= dev hpux include + +tags: + -ctags -dtf ${THP300} ${COMM} ${SHP300} + egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AHP300} | \ + sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ + >> ${THP300} + sort -o ${THP300} ${THP300} + +links: + -for i in ${DHP300}; do \ + cd ../$$i && rm -f tags; ln -s ../tags tags; done diff --git a/sys/arch/amiga/README.first b/sys/arch/amiga/README.first new file mode 100644 index 000000000000..5e5989e0da30 --- /dev/null +++ b/sys/arch/amiga/README.first @@ -0,0 +1,203 @@ +****************************************************************************** + +Here's the initial version of NetBSD for the Amiga. This version is strictly +for the kernel hackers among you, there's no sense in `normal' users trying +to install it, possibly killing their other partitions, facing kernel panics and +not knowing what to do. Please keep that in mind, if you feel like going on... + +****************************************************************************** + + +Currently supported equipment: +----------------------------- + +o any Amiga with either 68020/68851 or 68030, 6888[12] is currently required + (because fpu code is conditionally compilable in the kernel, and this + version contains fpu code). +o A3000 internal SCSI controller. Note that you cannot boot BSD currently + with any other SCSI controller (not to mention weird IDE interfaces..). +o internal RS232 port. This is not by default used as the system console. + you have to recompile if you want the console on the RS232. +o some `sort of' VT200 emulator for the custom chips display, which is + an NTSC laced, 640x400 monochrome display. This is the default console. +o disk and tape drivers using the mentioned A3000 scsi controller. + Disks I tried it on include: Wren7, IBM-OEM 0663E12, Quantum LP105S. + Only tape tested is my Wangtek 5150ES. + + +Some comments on these: +---------------------- +68020&68851/68030 support: + These cpu's should be fully supported. Note that you cannot run + BSD with a '30EC, the MMU is absolutely required. The '40 is + currently *NOT* supported, don't try! The reason for this is + the braindamaged, mind boggingly stupid '40 MMU, which only + implements a very limited subset of the 68851/68030 MMUs. In + particular, it doesn't deal with the current 2-level MMU + setup. See the extra doc about AMIGA-MMU for details. + Exception handling for the '40 is also different to its predecessors, + however this should be easier to implement than revamping + the MMU code to work on the '40. + +A3000 internal SCSI controller: + This is a driver tested on an AMD33C93A chip, I just hope I + didn't do anything that won't run on the dreadful WD33C93A-PROTO + still in use in thousands of A3000. It is a *VERY* rough + driver, it's really a hack, and should be replaced by a chip- + specific low-level driver for use with the generic scsi/* + code for the PC. Might even use Mach-drivers as well. The + driver would support DMA, if only DMA would work... That is, + DMA trashed my memory, so I disabled it for a while, and the + driver was degraded to a PIO in the meanwhile.. Hope to get + DMA up again RSN ... + Note that (contrary to Amiga Unix..) this driver should handle + drives ok that send sync-requests (it just rejects those..). + +Internal RS232 port: + Well, that's not exactly a terribly complicated thing.. It should + perform reasonably well, but I didn't really test it with file + transfers, just with my old VT100. It should do hardware flow- + control, but that's not tested either. The driver supports being + a console. + +Custom chips display, console: + I implemented the console in a two-layer approach stolen from + the hp300 implementation. There is a low-level layer (grf*) + responsible for creating a display (`view' in AmigaOS parlance), + and a hi-level layer (ite*) dealing with display of characters, + scrolling regions, handling keyboard, etc. This approach should + it make trivial to support consoles on custom graphics boards. + Grf currently opens an interlaced NTSC screen, with a resolution + of 1024x1024 pixels, and a visible display size of 640x400. It + provides for smooth scrolling of this display window inside the + larger bitmap (once the ioctl's are implemented..), and it can + handle overscan (by changing the visible display size and moving + the display offset). These ioctl's aren't implemented yet either. + Oh: don't try to convince me to offer a PAL display, I won't. + The console tries to be some sort of VT200 compatible terminal, + however, I only implemented a small subset of features. Essentially, + I took the existing HP-ite driver, a VT320 manual, and started + to replace the control sequences with the ones I found in the + manual. Don't expect the driver to do downloadable fonts or other + weird features, I think even scrolling regions might be broken + at the moment. It should however work reasonably well for most + editing purposes. + + +Keyboard: + Default keymap is US-ASCII. However, I reasoned quite a bit about + how to do the mapping of keys into characters and character + sequences to easily change the keymap to international layouts. + Dead-keys are supported, as well as having a second set of keys + reachable with the Alt keys (same usage as AmigaOS). Thus, you + should be able to generate an ö (oe) by typing Alt-k o. + However, currently any 8bit characters just appear as ^@ on the + screen, and I don't know whether the tty is responsible for this + misfeature, or whether I have a bug in my alt-key handling... + All keys sending sequences send as [ instead of + \x9b, as under AmigaOS. This should make use with Emacs, Bash, etc. + *much* easier. + For information about how keymaps work, look at dev/kbdmap.h and + dev/kbdmap.c. + +Disks: + See the special section on how RDBs map into BSD partitions. + +Tapes: + The tape driver seems to support a variety of different tape + drives. Chances are, your tape will work too. Just give it a try, + worst thing that can happen is a kernel panic ;-) + + + +RDB's and how BSD finds its partitions on disk drives +----------------------------------------------------- +BSD partition tables usually look like this: + A: boot partition, ~8M + B: swap partition, twice the (Fast)RAM size you have + C: the entire disk + D: /usr + E, F, G, H: additional partitions + +Since Amiga partitions are managed thru a RigidDiskBlock (RDB) stored +in the first cylinder(s) of a drive, I took the following approach to +map Amiga partitions to BSD A-H partitions: + +C: still is the entire disk. Take extreme care!! +A: has identifier: BSDR (Root fs) +B: has identifier: BSDS (Swap fs) +DEFGH: have identifiers: BSDD, BSDE, BSDF, BSDG, BSDH. + +BSD recognizes at most one partition of each type per drive, but you can +have multiple BSDD partitions on different drives, for example. + +There is no restriction on the volume name for those partitions, and +there's no restriction on the order of the partitions on the disk, you can +have BSDD before BSDR, for example. + +-> IMPORTANT NOTE: BSD will boot off the last BSDR partition it finds, + ie. if you have a BSDR partition on drives 0 and 6, + it will boot from the one in drive 6 !! + +I'm running BSD on my Amiga with BSDR, BSDS, BSDE on drive 6, and a +BSDD on drive 1. BSDD on drive 6 is a backup root filesystem, I can just +change its type to BSDR, change the BSDR type to BSDD (ie. swap them), and +boot off the other partition, without BSD noticing anything. + + +Using UFS partitions formatted under Amiga Unix System V Release 4 +------------------------------------------------------------------ +You can use such partitions under NetBSD-Amiga, however, you cannot use +partitions formatted (newfs/mkfs) under NetBSD-Amiga under Amix. Amix +uses the old BSD-4.2 ffs, and doesn't understand the new BSD-4.3 ffs. + + +Other documents +--------------- +The BSD distribution contains a huge doc directory, so if you want to +know everything about XYZ, chances are you'll find a manual for it there. +The other short docs in this distribution cover: + + AMIGA-MMU: short description of what's going on when initializing + the system. + + BUGS: you might guess what this contains :-) + + INSTALL: quick guide on how to install the included dump of the + root filesystem on your harddisk. This is quite risky, + please read the warnings, and only try the installation + if you feel totally confident that you understood the + process! + + README.first: this file. + + RECOMPILE: short notes about how to change the default configuration + (throw out unneeded drivers, add drivers for other + SCSI units, etc). Recompiling probably requires a lot + of experience in this sort of things (possibly from already + hacking around with the Mach kernel...), I'd imagine + make'ing the kernel requires a lot of unix'ish tools + not commonly found on `normal' amigas, however you + should find most of them in the Mach distribution. + + +Distribution of NetBSD-Amiga +---------------------------- +I'll try to put my updates on ftp.eunet.ch, given that I don't run out +of diskspace there. After integrating the Amiga changes into the official +NetBSD sources, you'll also be able to get the (entire) distribution +from sun-lamp.cs.berkeley.edu, or any of its mirrors. I'm using the +NetBSD-current sources, and am updating my source tree regularly, however I +didn't incorporate the most recent changes before the first release, since +I've worked with this version for some time now, and found it to be +fairly stable (so no loadable kernel modules yet in this release). + +There is going to be a mailing-list for NetBSD-Amiga, I'll post the +information to comp.unix.amiga when I know its definite name and location. + +You can reach me at mw@eunet.ch, please mention `BSD' in your Subject: +line, this makes it easier for me to automatically sort incoming mail +according to topic, thanks! + +-Markus Wild + diff --git a/sys/arch/amiga/RECOMPILE b/sys/arch/amiga/RECOMPILE new file mode 100644 index 000000000000..c7b5a2df3c69 --- /dev/null +++ b/sys/arch/amiga/RECOMPILE @@ -0,0 +1,63 @@ +How to recompile (under AmigaDOS) +--------------------------------- + +You need a fairly complete unix programming environment. You also need +gcc, I don't think any of the commercial compilers could recompile the +kernel. The central configuration directory is sys/arch/amiga/conf. CD +there, and take a look at the file AMIGA. Things you might change in +this file are: + +timezone: change to your timezone. + +options: comment out modules you don't need, to make the kernel + smaller. Good candidates for exclusion are probably + the ISOFS (CD filesystem), ISO and TPIP (implement OSI + sockets). PCFS is entirely untested, so you might + get rid of it as well. + +config: this is a vital line, it tells BSD where to find the + root filesystem and the swap partition. The device + name is composed of `sd', which is the disk driver, + the unit number (6 in the distributed file), and the + partition (A==root). + +disk: make sure there's an entry for your SCSI unit, the + kernel as distributed supports drives at units 0, 1 and + 6. + +tape: if you don't have a tape drive, you can remove those + entries, and save some space in the kernel. + +pseudo-device: you can safely remove `sl' and `bpfilter', please don't + remove `ite', or you'll end up without a console... + + +When you're happy with the config file, you have to run it thru the +config program. config is included in the bin directory of this +distribution, together with the loader. In sys/arch/amiga/conf, do + + config AMIGA + +After a moment, config reminds you to do a make depend, well, you can't, +there's no mkdep at the moment;-) Just make sure all object files of +previous runs are removed, then `make', and cross fingers. The make +process will need some binaries found in the bin directory of this +distribution, so add bin to your PATH before starting the compilation. + +The distributed console bitmap font is *UGLY*. I'd strongly suggest +you CD to sys/arch/amiga/stand/dumpfont, and generate a new font source +file containing the topaz.font of AmigaOS. This looks *much* nicer +than the free Mach font, but since it is part of AmigaOS, it is +owned by Commodore, and may not be redistributed, you'll have to regenerate +it, sorry. Dumpfont will output a new source file to stdout. Redirect +this output to a file, and then copy it to sys/arch/amiga/dev/kernel_font.c. +If you can't get dumpfont working on your system (or if you're +crosscompiling from a non-amiga system), copy the ugly +sys/arch/amiga/dev/kernel_font.c.distrib to sys/arch/amiga/dev/kernel_font.c +instead. + +If you run into problems recompiling, configuring, etc. first try to +find a solution yourself. I would prefer to work on BSD than to answer +tons of email, but if you're really stuck, you can reach me at mw@eunet.ch. + +-Markus Wild diff --git a/sys/arch/amiga/conf/AMIGA b/sys/arch/amiga/conf/AMIGA new file mode 100644 index 000000000000..390627f7ab72 --- /dev/null +++ b/sys/arch/amiga/conf/AMIGA @@ -0,0 +1,83 @@ +machine "amiga" +cpu "A3000" +ident GODZILLA + +timezone -1 dst +maxusers 16 + +# Standard options +#options QUOTA +options INET +options NFS,NFSSERVER,NFSCLIENT +options MFS +options ISOFS +options FIFO +options PCFS,KERNFS +options FDESC +options ISO +options TPIP + +options "COMPAT_43" +options "TCP_COMPAT_42" +options "COMPAT_NOMID" +options "HAVE_USL_UFS" + +# Options for all HP machines +#options SYSVSHM +#options HPUXCOMPAT + +# Options specific to this host. +options DEBUG,DIAGNOSTIC,FPCOPROC +# options PANICBUTTON +options KTRACE +#options "BUFPAGES=900" +options "NKMEMCLUSTERS=256" +options GENERIC +#options PROFTIMER,"PRF_INTERVAL=500" +#options KGDB,"KGDBDEV=15*256+2","KGDBRATE=19200" + +#config vmunix root on sd6a swap on sd6b +config vmunix swap generic + +# manufacturer 1 is a pseudo and stands for `builtin' +master scsi0 at manufacturer 1 product 1 +#master floppy0 at manufacturer 1 product 2 + +# further builtin devices +device ser0 at manufacturer 1 product 3 +#device clock at manufacturer 1 product 4 +#device kbd at manufacturer 1 product 5 +#device par at manufacturer 1 product 6 +#device mouse at manufacturer 1 product 8 + +disk sd0 at scsi0 slave 0 +disk sd1 at scsi0 slave 1 +disk sd2 at scsi0 slave 2 +disk sd3 at scsi0 slave 3 +disk sd4 at scsi0 slave 4 +disk sd5 at scsi0 slave 5 +disk sd6 at scsi0 slave 6 + +tape st0 at scsi0 slave 4 +tape st1 at scsi0 slave 5 + +device grf0 at manufacturer 1 product 7 + +# ethernet board +#device le0 at manufacturer ? product ? + +# my dear A2410 +#device tiga0 at manufacturer 1030 product 0 + +pseudo-device sl 4 +pseudo-device ppp 4 +pseudo-device bpfilter 16 +pseudo-device ite 1 +pseudo-device pty +pseudo-device loop +pseudo-device ether +pseudo-device vn 10 + +pseudo-device devpager +pseudo-device swappager +pseudo-device vnodepager diff --git a/sys/arch/amiga/conf/LINT.amiga b/sys/arch/amiga/conf/LINT.amiga new file mode 100644 index 000000000000..c5c136c3eff4 --- /dev/null +++ b/sys/arch/amiga/conf/LINT.amiga @@ -0,0 +1,67 @@ +# +# GENERIC HP9000/300 +# +machine "hp300" + +cpu "HP320" +cpu "HP330" +cpu "HP340" +cpu "HP350" +cpu "HP360" +cpu "HP370" +ident GENERIC + +timezone 7 dst +maxusers 8 + +# Standard 4.4bsd options +options QUOTA +options INET +options MFS,NFS +options "COMPAT_43" +options "COMPAT_42","TCP_COMPAT_42" + +# More standard options for the HPs +options MAPMEM,SYSVSHM +options HPUXCOMPAT + +# KTRACE: various kernel event traces +options KTRACE + +# DIAGNOSTIC: compile in lots of debugging and consistancy checking code. +options DIAGNOSTIC + +config vmunix swap generic + +master hpib0 at scode7 +master hpib1 at scode? +disk rd0 at hpib? slave 0 +disk rd1 at hpib? slave ? +disk rd2 at hpib? slave ? +disk rd3 at hpib? slave ? +tape ct0 at hpib? slave ? +tape ct1 at hpib? slave ? flags 1 +device ppi0 at hpib0 slave 5 + +master scsi0 at scode? +master scsi1 at scode? +disk sd0 at scsi? slave ? +disk sd1 at scsi? slave ? +disk sd2 at scsi? slave ? +disk sd3 at scsi? slave ? + +device dca0 at scode9 flags 1 +device dcm0 at scode? flags 0xe +device dcm1 at scode? flags 0xe +device dcl0 at scode? flags 0 +device dcl1 at scode? flags 0 +device le0 at scode? + +device grf0 at scode? +device grf1 at scode? + +pseudo-device ite +pseudo-device pty +pseudo-device loop +pseudo-device ether +pseudo-device clock diff --git a/sys/arch/amiga/conf/Makefile.amiga b/sys/arch/amiga/conf/Makefile.amiga new file mode 100644 index 000000000000..d49094c22045 --- /dev/null +++ b/sys/arch/amiga/conf/Makefile.amiga @@ -0,0 +1,151 @@ +# @(#)Makefile.hp300 7.10 (Berkeley) 6/27/91 +# +# Makefile for 4.4 BSD +# +# This makefile is constructed from a machine description: +# config machineid +# Most changes should be made in the machine description +# /sys/conf/``machineid'' +# after which you should do +# config machineid +# Machine generic makefile changes should be made in +# /sys/conf/Makefile.``machinetype'' +# after which config should be rerun for all machines of that type. +# +# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE +# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING +# +# -DTRACE compile in kernel tracing hooks +# -DQUOTA compile in file system quotas + + +# DEBUG is set to -g by config if debugging is requested (config -g). +# PROF is set to -pg by config if profiling is requested (config -p). +AS= gcc:compilers/amiga/2.3.3/as ${DEBUG} +CC= gcc ${DEBUG} +CPP= gcc:compilers/amiga/2.3.3/cpp -traditional +LD= ld.bsd +TOUCH= touch -f -c +GPROF.EX=/usr/src/usr.lib/libc/csu/amiga/gmon.ex + +# source tree is located via $S relative to the compilation directory +S= ../../../.. +AMIGA= ../.. + +INCLUDES= -I. -I$S/arch -I$S -I$S/sys +COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Damiga -DREFBIT +CFLAGS= -O -mc68020 -m68881 ${COPTS} + +# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} +# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, +# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file +# is marked as config-dependent. + +NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< +NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< + +DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< +DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< + +PROFILE_C= ${CC} -S -c ${COPTS} $<; \ + ex - $*.s < ${GPROF.EX}; \ + ${AS} -o $@ $*.s; \ + rm -f $*.s + +NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@ +NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ + +%OBJS + +%CFILES + +# load lines for config "xxx" will be emitted as: +# xxx: ${SYSTEM_DEP} swapxxx.o +# ${SYSTEM_LD_HEAD} +# ${SYSTEM_LD} swapxxx.o +# ${SYSTEM_LD_TAIL} +SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o +#SYSTEM_DEP= Makefile symbols.sort ${SYSTEM_OBJ} +SYSTEM_DEP= Makefile ${SYSTEM_OBJ} +SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ +SYSTEM_LD= @strip=-x; [ X${DEBUG} = X-g ] && strip=-X; \ + ${LD} $$strip -n -o $@ -e start ${SYSTEM_OBJ} vers.o +#SYSTEM_LD_TAIL= @echo rearranging symbols;\ +# symorder symbols.sort $@;\ +SYSTEM_LD_TAIL= @size $@; chmod 755 $@; \ + [ X${DEBUG} = X-g ] && { \ + echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ + echo strip -d $@; strip -d $@; } || true + +%LOAD + +newvers: + sh $S/conf/newvers.sh + ${CC} $(CFLAGS) -c vers.c + +clean: + rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \ + Errs errs linterrs makelinks + +lint: /tmp param.c + @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ + ${AMIGA}/amiga/Locore.c ${CFILES} ${AMIGA}/amiga/swapgeneric.c \ + ioconf.c param.c| \ + grep -v 'struct/union .* never defined' | \ + grep -v 'possible pointer alignment problem' + +symbols.sort: ${AMIGA}/amiga/symbols.raw + grep -v '^#' ${AMIGA}/amiga/symbols.raw \ + | sed 's/^ //' | sort -u > symbols.sort + +locore.o: assym.s ${AMIGA}/amiga/vectors.s ${AMIGA}/amiga/locore.s +locore.o: ${AMIGA}/include/trap.h ${AMIGA}/include/psl.h ${AMIGA}/amiga/pte.h +locore.o: ${AMIGA}/include/cpu.h + ${CPP} -DLOCORE ${COPTS} ${AMIGA}/amiga/locore.s | ${AS} -o locore.o + +# the following is necessary because autoconf.o depends on #if GENERIC +autoconf.o: Makefile + +# the following are necessary because the files depend on the types of +# hp cpu's included in the system configuration +clock.o machdep.o autoconf.o conf.o: Makefile + +# depend on network configuration +af.o uipc_proto.o locore.o: Makefile + +# depend on maxusers +assym.s: Makefile + +assym.s: genassym + ./genassym >assym.s + +genassym: + ${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Damiga -o genassym \ + ${AMIGA}/amiga/genassym.c + +depend: assym.s param.c + mkdep ${COPTS} ${CFILES} ioconf.c param.c + mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${AMIGA}/amiga/genassym.c + +links: + egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ + sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink + echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ + sort -u | comm -23 - dontlink | \ + sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks + sh makelinks && rm -f dontlink + +tags: + @echo "see $S/kern/Makefile for tags" + +ioconf.o: ioconf.c + ${CC} -c ${CFLAGS} ioconf.c + +param.c: $S/conf/param.c + rm -f param.c + cp $S/conf/param.c . + +param.o: param.c Makefile + ${CC} -c ${CFLAGS} ${PARAM} param.c + +%RULES diff --git a/sys/arch/amiga/conf/devices.amiga b/sys/arch/amiga/conf/devices.amiga new file mode 100644 index 000000000000..17eceb03216d --- /dev/null +++ b/sys/arch/amiga/conf/devices.amiga @@ -0,0 +1,4 @@ +fd 2 +sd 4 +cd 5 +vn 6 diff --git a/sys/arch/amiga/conf/files.amiga.old b/sys/arch/amiga/conf/files.amiga.old new file mode 100644 index 000000000000..71a46c71aeb6 --- /dev/null +++ b/sys/arch/amiga/conf/files.amiga.old @@ -0,0 +1,31 @@ +arch/amiga/amiga/amiga_init.c standard +arch/amiga/amiga/autoconf.c standard +arch/amiga/amiga/clock.c standard +arch/amiga/amiga/conf.c standard +arch/amiga/amiga/cons.c standard +arch/amiga/amiga/disksubr.c standard +arch/amiga/amiga/dkbad.c standard +arch/amiga/amiga/in_cksum.c optional inet +arch/amiga/amiga/machdep.c standard config-dependent +arch/amiga/amiga/mem.c standard +arch/amiga/amiga/ns_cksum.c optional ns +arch/amiga/amiga/oc_cksum.s optional inet +arch/amiga/amiga/pmap.c standard +arch/amiga/amiga/sys_machdep.c standard +arch/amiga/amiga/trap.c standard +arch/amiga/amiga/vm_machdep.c standard +arch/amiga/dev/dma.c optional scsi +arch/amiga/dev/vn.c optional vn +arch/amiga/dev/scsi.c optional scsi device-driver +arch/amiga/dev/sd.c optional sd +arch/amiga/dev/st.c optional st +arch/amiga/dev/ser.c optional ser device-driver +arch/amiga/dev/kbd.c optional ite +arch/amiga/dev/ite.c optional ite +arch/amiga/dev/ite_cc.c optional ite +arch/amiga/dev/ite_tg.c optional ite +arch/amiga/dev/kernel_font.c optional ite +arch/amiga/dev/kbdmap.c optional ite +arch/amiga/dev/grf.c optional grf +arch/amiga/dev/grf_cc.c optional grf +arch/amiga/dev/grf_tg.c optional grf diff --git a/sys/arch/amiga/include/ansi.h b/sys/arch/amiga/include/ansi.h new file mode 100644 index 000000000000..2683c6378802 --- /dev/null +++ b/sys/arch/amiga/include/ansi.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 1990 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. + * + * @(#)ansi.h 7.1 (Berkeley) 3/9/91 + */ + +#ifndef _ANSI_H_ +#define _ANSI_H_ + +/* + * Types which are fundamental to the implementation and may appear in + * more than one standard header are defined here. Standard headers + * then use: + * #ifdef _SIZE_T_ + * typedef _SIZE_T_ size_t; + * #undef _SIZE_T_ + * #endif + * + * Thanks, ANSI! + */ +#define _CLOCK_T_ unsigned long /* clock() */ +#define _PTRDIFF_T_ int /* ptr1 - ptr2 */ +#define _SIZE_T_ unsigned long /* sizeof() */ +#define _TIME_T_ long /* time() */ +#define _VA_LIST_ char * /* va_list */ +#define _WCHAR_T_ unsigned short /* wchar_t */ + +#endif /* _ANSI_H_ */ diff --git a/sys/arch/amiga/stand/dumpfont/dumpfont.c b/sys/arch/amiga/stand/dumpfont/dumpfont.c new file mode 100644 index 000000000000..5b8d561d9da9 --- /dev/null +++ b/sys/arch/amiga/stand/dumpfont/dumpfont.c @@ -0,0 +1,94 @@ +/* This is a *real* hack to dump the topaz80 kernel font. This one is + ways nicer than the ugly Mach font, but we'll have to dump it from a + running system to not run against Commodore copyrights. *NEVER* distribute + the generated font with BSD, always regenerate! */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +main() +{ + unsigned char str[256], *pp; + int i; + struct TextAttr ta = { "topaz.font", 8, FS_NORMAL, FPF_ROMFONT }; + struct RastPort rp; + struct BitMap bm = { 256, /* bytes per row */ + 8, /* rows */ + 0, /* flags */ + 1, /* depth */ + 0, /* pad */ + 0 }; /* planes */ + struct TextFont *tf; + + InitRastPort (& rp); + rp.BitMap = &bm; + bm.Planes[0] = pp = AllocRaster (256 * 8, 8); + + if (!pp) + { + fprintf (stderr, "Can't allocate raster!\n"); + exit (1); + } + bzero (pp, 256 * 8); + + tf = OpenFont (& ta); + if (! tf) + { + fprintf (stderr, "can't open topaz font.\n"); + exit (1); + } + + SetFont (&rp, tf); + + /* initialize string to be printed */ + for (i = 32; i < 256; i++) str[i - 32] = i; + + Move (&rp, 0, 6); + + Text (&rp, str, 256 - 32); + { + int bin = open ("bitmap", 1); + if (bin >= 0) + { + write (bin, pp, 256*8); + close (bin); + } + } + + /* dump them.. */ + printf ("/* generated automatically by dumpfont.c. *DONT* distribute\n"); + printf (" this file, it contains information Copyright by Commodore!\n"); + printf ("\n"); + printf (" This is the (new) topaz80 system font: */\n\n"); + + printf ("unsigned char kernel_font_width = 8;\n"); + printf ("unsigned char kernel_font_height = 8;\n"); + printf ("unsigned char kernel_font_lo = 32;\n"); + printf ("unsigned char kernel_font_hi = 255;\n\n"); + + printf ("unsigned char kernel_cursor[] = {\n"); + printf (" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\n\n"); + printf ("unsigned char kernel_font[] = {\n"); + + for (i = 0; i < 256 - 32; i++) + { + printf ("/* %c */ ", i + 32); + printf ("0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", + pp[i+0*256], pp[i+1*256], pp[i+2*256], pp[i+3*256], + pp[i+4*256], pp[i+5*256], pp[i+6*256], pp[i+7*256]); + } + printf ("};\n"); + + CloseFont (tf); + FreeRaster (pp, 256 * 8, 8); +} diff --git a/sys/arch/amiga/stand/loadbsd/loadbsd.c b/sys/arch/amiga/stand/loadbsd/loadbsd.c new file mode 100644 index 000000000000..d11b5b8266fc --- /dev/null +++ b/sys/arch/amiga/stand/loadbsd/loadbsd.c @@ -0,0 +1,223 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +struct ExpansionBase *ExpansionBase; + +#undef __LDPGSZ +#define __LDPGSZ 8192 + +void get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size); + +int +main (int argc, char *argv[]) +{ + struct exec e; + int fd; + + if (argc >= 2) + { + if ((fd = open (argv[1], 0)) >= 0) + { + if (read (fd, &e, sizeof (e)) == sizeof (e)) + { + if (e.a_magic == NMAGIC) + { + u_char *kernel; + int text_size; + struct ConfigDev *cd; + int num_cd; + + ExpansionBase= (struct ExpansionBase *) OpenLibrary ("expansion.library", 0); + if (! ExpansionBase) /* not supposed to fail... */ + abort(); + for (cd = 0, num_cd = 0; cd = FindConfigDev (cd, -1, -1); num_cd++) ; + + text_size = (e.a_text + __LDPGSZ - 1) & (-__LDPGSZ); + kernel = (u_char *) malloc (text_size + e.a_data + e.a_bss + + num_cd*sizeof(*cd) + 4); + + if (kernel) + { + if (read (fd, kernel, e.a_text) == e.a_text + && read (fd, kernel + text_size, e.a_data) == e.a_data) + { + int *knum_cd; + struct ConfigDev *kcd; + void *fastmem_start; + u_long fastmem_size, chipmem_size; + + get_mem_config (&fastmem_start, &fastmem_size, &chipmem_size); + + if (argc == 3 && !strcmp (argv[2], "-k")) + { + fastmem_start += 4*1024*1024; + fastmem_size -= 4*1024*1024; + } + + printf ("Using %dM FASTMEM at 0x%x, %dM CHIPMEM\n", + fastmem_size>>20, fastmem_start, chipmem_size>>20); + /* give them a chance to read the information... */ + sleep(2); + + bzero (kernel + text_size + e.a_data, e.a_bss); + knum_cd = (int *) (kernel + text_size + e.a_data + e.a_bss); + *knum_cd = num_cd; + if (num_cd) + for (kcd = (struct ConfigDev *) (knum_cd+1); + cd = FindConfigDev (cd, -1, -1); + *kcd++ = *cd) ; + startit (kernel, + text_size + e.a_data + e.a_bss + num_cd*sizeof(*cd) + 4, + e.a_entry, fastmem_start, + fastmem_size, chipmem_size); + } + else + fprintf (stderr, "Executable corrupt!\n"); + } + else + fprintf (stderr, "Out of memory! (%d)\n", text_size + e.a_data + e.a_bss + + num_cd*sizeof(*cd) + 4); + } + else + fprintf (stderr, "Unsupported executable: %o\n", e.a_magic); + } + else + fprintf (stderr, "Can't read header of %s\n", argv[1]); + + close (fd); + } + else + perror ("open"); + } + else + fprintf (stderr, "%0 some-vmunix\n", argv[0]); +} + + +void +get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size) +{ + extern struct ExecBase *SysBase; + struct MemHeader *mh, *nmh; + + *fastmem_size = 0; + *chipmem_size = 0; + + /* walk thru the exec memory list */ + Forbid (); + for (mh = (struct MemHeader *) SysBase->MemList.lh_Head; + nmh = (struct MemHeader *) mh->mh_Node.ln_Succ; + mh = nmh) + { + if (mh->mh_Attributes & MEMF_CHIP) + { + /* there should hardly be more than one entry for chip mem, but + handle it the same nevertheless */ + if ((u_int)mh->mh_Upper - (u_int)mh->mh_Lower > *chipmem_size) + { + *chipmem_size = (u_int)mh->mh_Upper - (u_int)mh->mh_Lower; + /* round to multiple of 512K */ + *chipmem_size = (*chipmem_size + 512*1024 - 1) & -(512*1024); + + /* chipmem always starts at 0, so don't remember start + address */ + } + } + else + { + if ((u_int)mh->mh_Upper - (u_int)mh->mh_Lower > *fastmem_size) + { + u_int start = (u_int) mh->mh_Lower; + u_int end = (u_int) mh->mh_Upper; + + /* some heuristics.. */ + start &= -__LDPGSZ; + /* get the mem back stolen by incore kickstart on A3000 with + V36 bootrom. */ + if (end == 0x07f80000) + end = 0x08000000; + + *fastmem_size = end - start; + *fastmem_start = (void *)start; + } + } + } + Permit(); +} + + + + +asm (" + .set ABSEXECBASE,4 + + .text + .globl _startit + +_startit: + movel sp,a3 + movel 4:w,a6 + lea pc@(start_super-.+2),a5 + jmp a6@(-0x1e) | supervisor-call + +start_super: + movew #0x2700,sr + + | the BSD kernel wants values into the following registers: + | a0: fastmem-start + | d0: fastmem-size + | d1: chipmem-size + + movel a3@(4),a1 | loaded kernel + movel a3@(8),d2 | length of loaded kernel + movel a3@(12),a2 | entry point + movel a3@(16),a0 | fastmem-start + movel a3@(20),d0 | fastmem-size + movel a3@(24),d1 | chipmem-size + subl a4,a4 | target, load to 0 + + lea pc@(zero-.+2),a3 + pmove a3@,tc | Turn off MMU + lea pc@(nullrp-.+2),a3 + pmove a3@,crp | Turn off MMU some more + pmove a3@,srp | Really, really, turn off MMU + +| Turn off 68030 TT registers + + btst #2,(ABSEXECBASE)@(0x129) | AFB_68030,SysBase->AttnFlags + beq nott | Skip TT registers if not 68030 + lea pc@(zero-.+2),a3 + .word 0xf013,0x0800 | pmove a3@,tt0 (gas only knows about 68851 ops..) + .word 0xf013,0x0c00 | pmove a3@,tt1 (gas only knows about 68851 ops..) + +nott: + + movew #(1<<9),0xdff096 | disable DMA + +L0: + moveb a1@+,a4@+ + subl #1,d2 + bcc L0 + + + jmp a2@ + + +| A do-nothing MMU root pointer (includes the following long as well) + +nullrp: .long 0x7fff0001 +zero: .long 0 + + +"); +