*BSD News Article 8106


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.hawaii.edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!devnull!altair!fmayhar
From: fmayhar@altair.mpd.tandem.com (Frank Mayhar)
Newsgroups: comp.unix.bsd
Subject: [386BSD] Config ignores "flags" param!  + FIX
Message-ID: <2998@devnull.mpd.tandem.com>
Date: 25 Nov 92 22:14:25 GMT
Sender: news@devnull.mpd.tandem.com
Reply-To: fmayhar@mpd.tandem.com
Organization: Tandem Computers (MPD) Austin, TX
Lines: 214

See the README.  A copy of this also send to Terry Lambert for (hopefully)
inclusion in the patchkit.

#! /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:  README config-flag-patch
# Wrapped by fmayhar@altair on Wed Nov 25 16:09:39 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(926 characters\)
sed "s/^X//" >README <<'END_OF_README'
XThis is a patch to add a working 'flags' parameter to device specifications
Xin config files.  I'm working on Chris Demetriou's new com driver, and wanted
Xa way to turn on "real carrier" by default, rather than using his comcontrol
Xcommand.  Since Sun uses the flags parameter for a similar function, I thought
XI would emulate them.  Looked around, and lo and behold, the flags param,
Xwhile syntactically OK, is ignored!
X
XSo this is a patch to usr.sbin/config/mkioconf.c to emit the flags parameter
Xwith the rest of the isa_device info, and to sys.386bsd/i386/isa/isa_device.h,
Xto insert an "id_flags" entry into the isa_device structure.  I made "id_flags"
Xan int; would have liked a short, but I wanted to preserve the structure
Xalignment.
X
XTo apply, extract into /tmp, cd /usr/src, then patch </tmp/config-flag-patch
X
XUse this in a config file like:
X
Xdevice	com0    at isa? port "IO_COM1" tty irq 3 flags 0x1 vector comintr
END_OF_README
if test 926 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f config-flag-patch -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"config-flag-patch\"
else
echo shar: Extracting \"config-flag-patch\" \(5911 characters\)
sed "s/^X//" >config-flag-patch <<'END_OF_config-flag-patch'
X*** sys.386bsd/i386/isa/isa_device.h.save	Tue Nov 24 23:40:37 1992
X--- sys.386bsd/i386/isa/isa_device.h	Tue Nov 24 23:41:15 1992
X***************
X*** 49,54 ****
X--- 49,55 ----
X  	int	id_msize;	/* size of i/o memory */
X  	int	(*id_intr)();	/* interrupt interface routine */
X  	int	id_unit;	/* unit number */
X+ 	int	id_flags;	/* per-device flags, if any */
X  	int	id_scsiid;	/* scsi id if needed */
X  	int	id_alive;	/* device is present */
X  };
X*** usr.sbin/config/mkioconf.c.save	Wed Nov 25 00:03:49 1992
X--- usr.sbin/config/mkioconf.c	Wed Nov 25 00:17:30 1992
X***************
X*** 649,655 ****
X  		}
X  		fprintf(fp, "\nstruct isa_device isa_devtab_bio[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X--- 649,655 ----
X  		}
X  		fprintf(fp, "\nstruct isa_device isa_devtab_bio[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit   flags */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X***************
X*** 660,674 ****
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
X  		}
X  		fprintf(fp, "0\n};\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_tty[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X--- 660,675 ----
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d, 0x%x },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit,
X! 			 dp->d_flags);
X  		}
X  		fprintf(fp, "0\n};\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_tty[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit   flags */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X***************
X*** 679,693 ****
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_net[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X--- 680,695 ----
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d, 0x%x },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit,
X! 			 dp->d_flags);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_net[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit   flags */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X***************
X*** 698,712 ****
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_null[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X--- 700,715 ----
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d, 0x%x },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit,
X! 			 dp->d_flags);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  
X  		fprintf(fp, "struct isa_device isa_devtab_null[] = {\n");
X  		fprintf(fp, "\
X! /* driver 	iobase	irq   drq     maddr    msiz    intr   unit   flags */\n");
X  		for (dp = dtab; dp != 0; dp = dp->d_next) {
X  			mp = dp->d_conn;
X  			if (dp->d_unit == QUES || mp == 0 ||
X***************
X*** 717,725 ****
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  	}
X--- 720,729 ----
X  		 fprintf(fp, "{ &%sdriver,  %8.8s,", dp->d_name, dp->d_port);
X  			else
X  	 fprintf(fp, "{ &%sdriver,     0x%03x,", dp->d_name, dp->d_portn);
X! 		fprintf(fp, " %5.5s, %2d,  C 0x%05X, %5d, V(%s%d),  %2d, 0x%x },\n",
X  			 	sirq(dp->d_irq), dp->d_drq, dp->d_maddr,
X! 			 dp->d_msize, dp->d_name, dp->d_unit, dp->d_unit,
X! 			 dp->d_flags);
X  		}
X  		fprintf(fp, "0\n};\n\n");
X  	}
END_OF_config-flag-patch
if test 5911 -ne `wc -c <config-flag-patch`; then
    echo shar: \"config-flag-patch\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
-- 
Frank Mayhar  fmayhar@mpd.tandem.com
              Tandem Computers, Inc.  Micro Products Division
              14231 Tandem Blvd., Austin, TX  78728    Phone:  (512) 244-8969