summaryrefslogtreecommitdiff
path: root/sys/dev/microcode
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2004-09-18 19:51:54 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2004-09-18 19:51:54 +0000
commit4fda7fbd12effc60a1a03b72a68de99db77730f0 (patch)
treedcde9dbab24bdbb7aab14c00a4365af8347f326c /sys/dev/microcode
parentb05f7f51a2678f9d2c01195a629bc2fa5d04447c (diff)
repair build that reused y.tab.h for two different parsers
thus failing a build every other time. make generated arrays const and repair rcsid generation for output. allow one-step build; from krw@ krw@ ok
Diffstat (limited to 'sys/dev/microcode')
-rw-r--r--sys/dev/microcode/aic7xxx/Makefile22
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm.c10
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm_gram.y15
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm_macro_scan.l6
-rw-r--r--sys/dev/microcode/aic7xxx/aicasm_scan.l6
5 files changed, 37 insertions, 22 deletions
diff --git a/sys/dev/microcode/aic7xxx/Makefile b/sys/dev/microcode/aic7xxx/Makefile
index d8ebe9e5d96..a3031e1aa47 100644
--- a/sys/dev/microcode/aic7xxx/Makefile
+++ b/sys/dev/microcode/aic7xxx/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.8 2004/05/19 00:35:18 krw Exp $
+# $OpenBSD: Makefile,v 1.9 2004/09/18 19:51:53 mickey Exp $
# $FreeBSD: src/sys/dev/aic7xxx/Makefile,v 1.6 1999/08/28 00:41:22 peter Exp $
PROG= aicasm
@@ -6,7 +6,7 @@ PROG= aicasm
CSRCS= aicasm.c aicasm_symbol.c
GENSRCS= aicasm_gram.c aicasm_scan.c aicasm_macro_gram.c aicasm_macro_scan.c
-GENHDRS= y.tab.h
+GENHDRS= aicasm_gram.h aicasm_macro_gram.h
SRCS= ${GENSRCS} ${CSRCS}
CLEANFILES+= ${GENSRCS} ${GENHDRS} y.output
@@ -20,8 +20,8 @@ LDADD+= -ll
DEPENDFILE=
.endif
-CFLAGS+= -I/usr/include -I.
-YFLAGS= ${.TARGET:M*macro*:S/$(.TARGET)/-p mm/} -d
+CFLAGS+= -I/usr/include -I. -I${.CURDIR}
+YFLAGS= -d
LFLAGS+= ${.TARGET:M*macro*:S/$(.TARGET)/-olex.yy.c/} ${.TARGET:M*macro*:S/$(.TARGET)/-Pmm/}
NOMAN= noman
@@ -34,7 +34,17 @@ SEQFLAGS= -l seq.lst
microcode: 7xxx_headers 79xx_headers
-7xxx_headers: aic7xxx.seq aic7xxx.reg
+aicasm_gram.c aicasm_gram.h: aicasm_gram.y
+ ${YACC} ${YFLAGS} $<
+ @mv y.tab.c aicasm_gram.c
+ @mv y.tab.h aicasm_gram.h
+
+aicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y
+ ${YACC} -pmm ${YFLAGS} $<
+ @mv y.tab.c aicasm_macro_gram.c
+ @mv y.tab.h aicasm_macro_gram.h
+
+7xxx_headers: aicasm aic7xxx.seq aic7xxx.reg
${OBJDIR}./aicasm -I/sys ${SEQFLAGS} -r tempreg.h -o tempseq.h ${.CURDIR}/aic7xxx.seq
grep OpenBSD: ${.CURDIR}/aic7xxx.seq | cat - tempseq.h > aic7xxx_seq.h
grep OpenBSD: ${.CURDIR}/aic7xxx.reg | cat - tempreg.h > aic7xxx_reg.h
@@ -45,7 +55,7 @@ microcode: 7xxx_headers 79xx_headers
.endif
rm -f tempseq.h tempreg.h
-79xx_headers: aic79xx.seq aic79xx.reg
+79xx_headers: aicasm aic79xx.seq aic79xx.reg
${OBJDIR}./aicasm -I/sys ${SEQFLAGS} -r tempreg.h -o tempseq.h ${.CURDIR}/aic79xx.seq
grep OpenBSD: ${.CURDIR}/aic79xx.seq | cat - tempseq.h > aic79xx_seq.h
grep OpenBSD: ${.CURDIR}/aic79xx.reg | cat - tempreg.h > aic79xx_reg.h
diff --git a/sys/dev/microcode/aic7xxx/aicasm.c b/sys/dev/microcode/aic7xxx/aicasm.c
index c6c01857a4c..e488d2bcdbf 100644
--- a/sys/dev/microcode/aic7xxx/aicasm.c
+++ b/sys/dev/microcode/aic7xxx/aicasm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aicasm.c,v 1.12 2004/06/12 03:37:19 krw Exp $ */
+/* $OpenBSD: aicasm.c,v 1.13 2004/09/18 19:51:53 mickey Exp $ */
/*
* Aic7xxx SCSI host adapter firmware asssembler
*
@@ -38,7 +38,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aicasm.c,v 1.12 2004/06/12 03:37:19 krw Exp $
+ * $Id: aicasm.c,v 1.13 2004/09/18 19:51:53 mickey Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm.c,v 1.37 2004/03/12 21:45:25 trhodes Exp $
*/
@@ -367,7 +367,7 @@ output_code()
" *\n"
"%s */\n", versions);
- fprintf(ofile, "static uint8_t seqprog[] = {\n");
+ fprintf(ofile, "static const uint8_t seqprog[] = {\n");
for (cur_instr = TAILQ_FIRST(&seq_program);
cur_instr != NULL;
cur_instr = TAILQ_NEXT(cur_instr, links)) {
@@ -420,7 +420,7 @@ output_code()
}
fprintf(ofile,
-"static struct patch {\n"
+"static const struct patch {\n"
" %spatch_func_t *patch_func;\n"
" uint32_t begin :10,\n"
" skip_instr :10,\n"
@@ -440,7 +440,7 @@ output_code()
fprintf(ofile, "\n};\n\n");
fprintf(ofile,
-"static struct cs {\n"
+"static const struct cs {\n"
" uint16_t begin;\n"
" uint16_t end;\n"
"} critical_sections[] = {\n");
diff --git a/sys/dev/microcode/aic7xxx/aicasm_gram.y b/sys/dev/microcode/aic7xxx/aicasm_gram.y
index 2c84b9215b7..4b5e9d2c570 100644
--- a/sys/dev/microcode/aic7xxx/aicasm_gram.y
+++ b/sys/dev/microcode/aic7xxx/aicasm_gram.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: aicasm_gram.y,v 1.11 2003/12/24 23:27:55 krw Exp $ */
+/* $OpenBSD: aicasm_gram.y,v 1.12 2004/09/18 19:51:53 mickey Exp $ */
/* $NetBSD: aicasm_gram.y,v 1.3 2003/04/19 19:26:11 fvdl Exp $ */
/*
@@ -1912,7 +1912,8 @@ add_conditional(symbol_t *symbol)
static void
add_version(const char *verstring)
{
- const char prefix[] = " * ";
+ const char *q, prefix[] = " * ";
+ char *p;
int newlen;
int oldlen;
@@ -1924,9 +1925,13 @@ add_version(const char *verstring)
if (versions == NULL)
stop("Can't allocate version string", EX_SOFTWARE);
strcpy(&versions[oldlen], prefix);
- strcpy(&versions[oldlen + strlen(prefix)], verstring);
- versions[newlen + oldlen] = '\n';
- versions[newlen + oldlen + 1] = '\0';
+ for (p = &versions[oldlen + strlen(prefix)], q = verstring; *q; q++) {
+ if (*q == '$')
+ continue;
+ *p++ = *q;
+ }
+ *p++ = '\n';
+ *p = '\0';
}
void
diff --git a/sys/dev/microcode/aic7xxx/aicasm_macro_scan.l b/sys/dev/microcode/aic7xxx/aicasm_macro_scan.l
index 7932e696051..3b63657d660 100644
--- a/sys/dev/microcode/aic7xxx/aicasm_macro_scan.l
+++ b/sys/dev/microcode/aic7xxx/aicasm_macro_scan.l
@@ -1,6 +1,6 @@
%{
/*
-/* $OpenBSD: aicasm_macro_scan.l,v 1.3 2004/06/12 03:37:20 krw Exp $ */
+/* $OpenBSD: aicasm_macro_scan.l,v 1.4 2004/09/18 19:51:53 mickey Exp $ */
/*
* Sub-Lexical Analyzer for macro invokation in
* the Aic7xxx SCSI Host adapter sequencer assembler.
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aicasm_macro_scan.l,v 1.3 2004/06/12 03:37:20 krw Exp $
+ * $Id: aicasm_macro_scan.l,v 1.4 2004/09/18 19:51:53 mickey Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l,v 1.5 2003/12/16 23:54:07 gibbs Exp $
*/
@@ -61,7 +61,7 @@
#include "aicasm.h"
#include "aicasm_symbol.h"
-#include "y.tab.h"
+#include "aicasm_macro_gram.h"
#define MAX_STR_CONST 4096
static char string_buf[MAX_STR_CONST];
diff --git a/sys/dev/microcode/aic7xxx/aicasm_scan.l b/sys/dev/microcode/aic7xxx/aicasm_scan.l
index b682cfda1a3..27fe114d60f 100644
--- a/sys/dev/microcode/aic7xxx/aicasm_scan.l
+++ b/sys/dev/microcode/aic7xxx/aicasm_scan.l
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: aicasm_scan.l,v 1.8 2004/06/12 03:37:20 krw Exp $ */
+/* $OpenBSD: aicasm_scan.l,v 1.9 2004/09/18 19:51:53 mickey Exp $ */
/*
* Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler.
*
@@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aicasm_scan.l,v 1.8 2004/06/12 03:37:20 krw Exp $
+ * $Id: aicasm_scan.l,v 1.9 2004/09/18 19:51:53 mickey Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_scan.l,v 1.22 2003/12/16 23:54:07 gibbs Exp $
*/
@@ -60,7 +60,7 @@
#include "aicasm.h"
#include "aicasm_symbol.h"
-#include "y.tab.h"
+#include "aicasm_gram.h"
/* This is used for macro body capture too, so err on the large size. */
#define MAX_STR_CONST 4096