jbm@uncle.UUCP (John B. Milton) (09/26/88)
Kind of boring, really. This is entirely a rip-off of Ford's vidram device driver. In fact, it should probably be added as a minor device on that one. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: Files INSTALL Install Makefile Name Remove Size rom.c # Wrapped by jbm@uncle on Sun Sep 25 16:47:29 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Files' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Files'\" else echo shar: Extracting \"'Files'\" \(45 characters\) sed "s/^X//" >'Files' <<'END_OF_FILE' XSize XInstall XName XRemove XFiles XINSTALL Xrom.o END_OF_FILE if test 45 -ne `wc -c <'Files'`; then echo shar: \"'Files'\" unpacked with wrong size! fi # end of 'Files' fi if test -f 'INSTALL' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'INSTALL'\" else echo shar: Extracting \"'INSTALL'\" \(933 characters\) sed "s/^X//" >'INSTALL' <<'END_OF_FILE' Xset -e # exit if there anything goes wrong X XDRIVER=rom X Xif [ ! -f ${DRIVER}.o ]; then X echo "you must make ${DRIVER}.o before running INSTALL" 1>&2 X exit 1 Xfi X Xif [ ! -c /dev/rom ]; then X /etc/masterupd -d ${DRIVER} X /etc/masterupd -a char release open close read ${DRIVER} X X # get the assigned device number X MAJOR=`/etc/masterupd -c ${DRIVER}` X if [ $? -ne 0 ]; then X echo "${DRIVER} cannot be added to the /etc/master file" 1>&2 X exit 1 X fi X X rm -f /dev/rom > /dev/null 2>&1 X /etc/mknod /dev/rom c $MAJOR 0 Xfi X Xcp ${DRIVER}.o /etc/lddrv/ X Xcd /etc/lddrv X X# remove the driver if it's already running X X./lddrv -q ${DRIVER} && ./lddrv -d ${DRIVER} X X# allocate and load the module X Xif ./lddrv -a ${DRIVER} Xthen X echo "Driver ${DRIVER} successfully loaded" Xelse X echo "Error: Driver ${DRIVER} failed loading stage" 1>&2 X exit 1 Xfi X X# load the driver at boot time X Xgrep "^${DRIVER}\$" drivers > /dev/null || echo ${DRIVER} >> drivers END_OF_FILE if test 933 -ne `wc -c <'INSTALL'`; then echo shar: \"'INSTALL'\" unpacked with wrong size! fi chmod +x 'INSTALL' # end of 'INSTALL' fi if test -f 'Install' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Install'\" else echo shar: Extracting \"'Install'\" \(241 characters\) sed "s/^X//" >'Install' <<'END_OF_FILE' X# Install script for /dev/rom driver X XDRIVER=rom X X./INSTALL || exit 1 X Xcd /etc/lddrv X X# put an entry in InstDrv for ${DRIVER} Xcat >> InstDrv << EOF XName=/dev/rom driver XFile=${DRIVER} XEOF X X Xecho "The /dev/rom driver is now installed" Xexit 0 END_OF_FILE if test 241 -ne `wc -c <'Install'`; then echo shar: \"'Install'\" unpacked with wrong size! fi chmod +x 'Install' # end of 'Install' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(435 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' XD=-O XCFLAGS= $D XDRIVER=rom X Xinstall : $(DRIVER).o X ./INSTALL X Xall : $(DRIVER)+IN X Xinstallable : $(DRIVER)+IN X X$(DRIVER)+IN : $(DRIVER).o X cpio -oBc < Files > $(DRIVER)+IN X Xfloppy : $(DRIVER)+IN X echo "Insert a formatted floppy disk and press return"; read foo X dd if=$(DRIVER)+IN of=/dev/rfp021 bs=16384 X Xclean: X rm $(DRIVER).o $(DRIVER)+IN X Xclobber: clean X Xshar: X shar Files INSTALL Install Makefile Name Remove Size rom.c >rom.shar END_OF_FILE if test 435 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'Name' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Name'\" else echo shar: Extracting \"'Name'\" \(31 characters\) sed "s/^X//" >'Name' <<'END_OF_FILE' X/dev/rom driver by John Milton END_OF_FILE if test 31 -ne `wc -c <'Name'`; then echo shar: \"'Name'\" unpacked with wrong size! fi # end of 'Name' fi if test -f 'Remove' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Remove'\" else echo shar: Extracting \"'Remove'\" \(161 characters\) sed "s/^X//" >'Remove' <<'END_OF_FILE' Xrm -f /dev/rom X Xcd /etc/lddrv X./lddrv -dv rom Xecho '/^rom$/d Xw' | ed - drivers Xrm -f ifile.rom rom rom.o X X/etc/masterupd -d rom X X Xecho "/dev/rom driver REMOVED" END_OF_FILE if test 161 -ne `wc -c <'Remove'`; then echo shar: \"'Remove'\" unpacked with wrong size! fi chmod +x 'Remove' # end of 'Remove' fi if test -f 'Size' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Size'\" else echo shar: Extracting \"'Size'\" \(3 characters\) sed "s/^X//" >'Size' <<'END_OF_FILE' X42 END_OF_FILE if test 3 -ne `wc -c <'Size'`; then echo shar: \"'Size'\" unpacked with wrong size! fi # end of 'Size' fi if test -f 'rom.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'rom.c'\" else echo shar: Extracting \"'rom.c'\" \(1778 characters\) sed "s/^X//" >'rom.c' <<'END_OF_FILE' X X/* /dev/rom loadable driver. XThis was entirely ripped off from the vidram driver by Ford (a.k.a Mike Ditto) XThis make the UNIXpc boot rom available through a device. A "strings /dev/rom" Xshows the sccs id: @(#)promp3. If anyone has anything different, please tell me. XI have not checked the ROM in my other (older) machine. I know it is different Xbecuase in beeps when power is first applied. X*/ X X#define KERNEL X X#include <sys/types.h> X#include <sys/param.h> X#include <sys/inode.h> X#include <sys/proc.h> X#include <sys/user.h> X#include <sys/conf.h> X#include <sys/errno.h> X#include <sys/systm.h> X#include <sys/iohw.h> X X/* the ROM space is decoded by a 74F139 on page 17 of 25 of the schematics, Xtaking up 1 of the 4 meg chunks. The top chunk at $0C is I/O */ X#define ROMMEM 0x00800000 X/*efine ROMSIZE 0x00400000 /* this for entire 4M chunk $800000 to BFFFFF */ X/*efine ROMSIZE 0x00008000 /* this for 2x27128=32k */ X#define ROMSIZE 0x00004000 /* this for 2x2764=16k */ X Xint romstate; X#define ROMOPEN 0x01 X Xromrelease() X{ X if (romstate & ROMOPEN) X u.u_error = EBUSY; X} X Xromopen(dev,flag) Xdev_t dev; Xint flag; X{ X if (minor(dev)) { /* we only support minor device number of 0 */ X u.u_error = ENODEV; X return; X } X romstate |= ROMOPEN; X} X Xromclose(dev,flag) Xdev_t dev; Xint flag; X{ X romstate &= ~ROMOPEN; X} X Xromread() X{ X register unsigned char ch; X X if (u.u_offset < 0 || u.u_offset >= ROMSIZE) { X u.u_error = ENODEV; X return; X } X X if (u.u_offset + u.u_count > ROMSIZE) X u.u_count = ROMSIZE - u.u_offset; X X while (u.u_count>0) { X register unsigned short *addr = X (unsigned short *)((char *)ROMMEM+(u.u_offset&~1)); X X if (u.u_offset & 1) X ch = *addr & 0xff; X else X ch = *addr >> 8; X if (subyte(u.u_base, ch)) X return; X X ++u.u_offset; X ++u.u_base; X --u.u_count; X } X} END_OF_FILE if test 1778 -ne `wc -c <'rom.c'`; then echo shar: \"'rom.c'\" unpacked with wrong size! fi # end of 'rom.c' fi echo shar: End of shell archive. exit 0 -- John Bly Milton IV, jbm@uncle.UUCP, n8emr!uncle!jbm@osu-cis.cis.ohio-state.edu home: (614) 294-4823, work: (614) 459-7641; CP/M to MP/M, MS-DOS to OS/2