[Midnightbsd-cvs] src: sys/tools: Bring in new tools
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Sep 12 15:41:13 EDT 2008
Log Message:
-----------
Bring in new tools
Modified Files:
--------------
src/sys/tools:
acpi_quirks2h.awk (r1.1.1.1 -> r1.2)
fw_stub.awk (r1.1.1.1 -> r1.2)
vnode_if.awk (r1.1.1.1 -> r1.2)
Added Files:
-----------
src/sys/tools:
bus_macro.sh (r1.1)
-------------- next part --------------
Index: fw_stub.awk
===================================================================
RCS file: /home/cvs/src/sys/tools/fw_stub.awk,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/tools/fw_stub.awk -L sys/tools/fw_stub.awk -u -r1.1.1.1 -r1.2
--- sys/tools/fw_stub.awk
+++ sys/tools/fw_stub.awk
@@ -25,7 +25,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: src/sys/tools/fw_stub.awk,v 1.2.2.1 2006/02/23 02:13:32 mlaier Exp $
+# $FreeBSD: src/sys/tools/fw_stub.awk,v 1.6 2007/03/02 11:42:53 flz Exp $
#
# Script to generate module .c file from a list of firmware images
@@ -33,7 +33,7 @@
function usage ()
{
- print "usage: fw_stub <firmware:name>* [-m modname] [-c outfile]";
+ print "usage: fw_stub <firmware:name>* [-l name] [-m modname] [-c outfile]";
exit 1;
}
@@ -84,6 +84,17 @@
else
usage();
}
+ } else if (o == "l") {
+ if (length(ARGV[i]) > j) {
+ opt_l = substr(ARGV[i], j + 1);
+ break;
+ }
+ else {
+ if (++i < ARGC)
+ opt_l = ARGV[i];
+ else
+ usage();
+ }
} else
usage();
}
@@ -93,7 +104,7 @@
if (length(curr[2]) > 0)
shortnames[num_files] = curr[2];
else
- shortnames[num_files] = curr[2];
+ shortnames[num_files] = curr[1];
if (length(curr[3]) > 0)
versions[num_files] = int(curr[3]);
else
@@ -113,7 +124,12 @@
#include <sys/kernel.h>\
#include <sys/module.h>\
#include <sys/linker.h>\
-#include <sys/firmware.h>\n");
+#include <sys/firmware.h>\
+#include <sys/systm.h>\n");
+
+if (opt_l) {
+ printc("static long " opt_l "_license_ack = 0;");
+}
for (file_i = 0; file_i < num_files; file_i++) {
symb = filenames[file_i];
@@ -125,9 +141,20 @@
printc("\nstatic int\n"\
opt_m "_fw_modevent(module_t mod, int type, void *unused)\
{\
- struct firmware *fp;\
+ const struct firmware *fp, *parent;\
+ int error;\
switch (type) {\
- case MOD_LOAD:");
+ case MOD_LOAD:\n");
+
+if (opt_l) {
+ printc("\
+ TUNABLE_LONG_FETCH(\"legal." opt_l ".license_ack\", &" opt_l "_license_ack);\
+ if (!" opt_l "_license_ack) {\
+ printf(\"" opt_m ": You need to read the LICENSE file in /usr/share/doc/legal/" opt_l "/.\\n\");\
+ printf(\"" opt_m ": If you agree with the license, set legal." opt_l ".license_ack=1 in /boot/loader.conf.\\n\");\
+ return(EPERM);\
+ }\n");
+}
for (file_i = 0; file_i < num_files; file_i++) {
short = shortnames[file_i];
@@ -136,11 +163,7 @@
# '-', '.' and '/' are converted to '_' by ld/objcopy
gsub(/-|\.|\//, "_", symb);
- if (file_i == 0)
- reg = "\t\tfp = ";
- else
- reg = "\t\t(void)";
-
+ reg = "\t\tfp = ";
reg = reg "firmware_register(\"" short "\", _binary_" symb "_start , ";
reg = reg "(size_t)(_binary_" symb "_end - _binary_" symb "_start), ";
reg = reg version ", ";
@@ -148,21 +171,37 @@
if (file_i == 0)
reg = reg "NULL);";
else
- reg = reg "fp);";
+ reg = reg "parent);";
printc(reg);
+
+ printc("\t\tif (fp == NULL)");
+ printc("\t\t\tgoto fail_" file_i ";");
+ if (file_i == 0)
+ printc("\t\tparent = fp;");
}
-printc("\t\treturn (0);\
- case MOD_UNLOAD:");
+printc("\t\treturn (0);");
+
+for (file_i = num_files - 1; file_i > 0; file_i--) {
+ printc("fail_" file_i ":")
+ printc("\t\t(void)firmware_unregister(\"" shortnames[file_i - 1] "\");");
+}
+
+printc("\tfail_0:");
+printc("\t\treturn (ENXIO);");
+
+printc("\tcase MOD_UNLOAD:");
for (file_i = 1; file_i < num_files; file_i++) {
- printc("\t\tfirmware_unregister(\"" shortnames[file_i] "\");");
+ printc("\t\terror = firmware_unregister(\"" shortnames[file_i] "\");");
+ printc("\t\tif (error)");
+ printc("\t\t\treturn (error);");
}
-printc("\t\tfirmware_unregister(\"" shortnames[0] "\");");
+printc("\t\terror = firmware_unregister(\"" shortnames[0] "\");");
-printc("\t\treturn (0);\
+printc("\t\treturn (error);\
}\
return (EINVAL);\
}\
--- /dev/null
+++ sys/tools/bus_macro.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Copyright (c) 2004-2005 Poul-Henning Kamp.
+# 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.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+#
+# $FreeBSD: src/sys/tools/bus_macro.sh,v 1.1 2005/09/24 20:11:07 phk Exp $
+#
+# Generate the convenience macros at the bottom of sys/bus.h
+#
+
+macro () {
+
+ n=${1}
+ shift
+ echo -n "#define bus_${n}(r"
+ for i
+ do
+ echo -n ", ${i}"
+ done
+ echo ") \\"
+ echo -n " bus_space_${n}((r)->r_bustag, (r)->r_bushandle"
+ for i
+ do
+ echo -n ", (${i})"
+ done
+ echo ")"
+}
+
+macro barrier o l f
+
+for w in 1 2 4 8
+do
+ # macro copy_region_$w so dh do c
+ # macro copy_region_stream_$w ?
+ # macro peek_$w
+ for s in "" stream_
+ do
+ macro read_$s$w o
+ macro read_multi_$s$w o d c
+ macro read_region_$s$w o d c
+ macro set_multi_$s$w o v c
+ macro set_region_$s$w o v c
+ macro write_$s$w o v
+ macro write_multi_$s$w o d c
+ macro write_region_$s$w o d c
+ done
+done
Index: acpi_quirks2h.awk
===================================================================
RCS file: /home/cvs/src/sys/tools/acpi_quirks2h.awk,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/tools/acpi_quirks2h.awk -L sys/tools/acpi_quirks2h.awk -u -r1.1.1.1 -r1.2
--- sys/tools/acpi_quirks2h.awk
+++ sys/tools/acpi_quirks2h.awk
@@ -1,6 +1,6 @@
#!/usr/bin/awk -f
#
-# $FreeBSD: src/sys/tools/acpi_quirks2h.awk,v 1.3 2005/01/07 02:29:25 imp Exp $
+# $FreeBSD: src/sys/tools/acpi_quirks2h.awk,v 1.4 2007/03/22 18:16:43 jkim Exp $
#-
# Copyright (c) 2004 Mark Santcroos <marks at ripe.net>
@@ -78,7 +78,7 @@
M = match (REMAINDER, /\"[^\"]*\"/);
OEM_TABLE_ID = substr(REMAINDER, M, RLENGTH);
- printf("\t{ ACPI_TABLE_%s, OEM, {%s}, {%s} },\n",
+ printf("\t{ \"%s\", OEM, {%s}, {%s} },\n",
TABLE, OEM_ID, OEM_TABLE_ID) > OUTPUT;
}
@@ -92,7 +92,7 @@
M = match ($0, /\"[^\"]*\"/);
CREATOR = substr($0, M, RLENGTH);
- printf("\t{ ACPI_TABLE_%s, CREATOR, {%s} },\n",
+ printf("\t{ \"%s\", CREATOR, {%s} },\n",
TABLE, CREATOR) > OUTPUT;
}
@@ -107,7 +107,7 @@
# Parse operand
OPERAND = trans_sign(SIGN);
- printf("\t{ ACPI_TABLE_%s, OEM_REV, {.op = %s}, {.rev = %s} },\n",
+ printf("\t{ \"%s\", OEM_REV, {.op = %s}, {.rev = %s} },\n",
TABLE, OPERAND, VALUE) > OUTPUT;
}
@@ -122,7 +122,7 @@
# Parse operand
OPERAND = trans_sign(SIGN);
- printf("\t{ ACPI_TABLE_%s, CREATOR_REV, {.op = %s}, {.rev = %s} },\n",
+ printf("\t{ \"%s\", CREATOR_REV, {.op = %s}, {.rev = %s} },\n",
TABLE, OPERAND, VALUE) > OUTPUT;
}
@@ -130,7 +130,7 @@
# QUIRKS field: This is the last line of every entry
#
$1 == "quirks:" {
- printf("\t{ ACPI_TABLE_END }\n};\n\n") > OUTPUT;
+ printf("\t{ \"\" }\n};\n\n") > OUTPUT;
QUIRKS = $0;
sub(/^quirks:[ ]*/ , "", QUIRKS);
Index: vnode_if.awk
===================================================================
RCS file: /home/cvs/src/sys/tools/vnode_if.awk,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/tools/vnode_if.awk -L sys/tools/vnode_if.awk -u -r1.1.1.1 -r1.2
--- sys/tools/vnode_if.awk
+++ sys/tools/vnode_if.awk
@@ -30,12 +30,13 @@
#
# @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93
-# $FreeBSD: src/sys/tools/vnode_if.awk,v 1.50 2005/06/09 20:20:30 ssouhlal Exp $
+# $FreeBSD: src/sys/tools/vnode_if.awk,v 1.55 2006/05/30 21:13:28 dds Exp $
#
# Script to produce VFS front-end sugar.
#
-# usage: vnode_if.awk <srcfile> [-c | -h]
+# usage: vnode_if.awk <srcfile> [-c | -h | -p | -q]
# (where <srcfile> is currently /sys/kern/vnode_if.src)
+# The source file must have a .src extension
#
function usage()
@@ -46,6 +47,7 @@
function die(msg, what)
{
+ printf srcfile "(" fnr "): " > "/dev/stderr";
printf msg "\n", what > "/dev/stderr";
exit 1;
}
@@ -146,7 +148,7 @@
" * This file is produced automatically.\n" \
" * Do not modify anything in here by hand.\n" \
" *\n" \
- " * Created from $FreeBSD: src/sys/tools/vnode_if.awk,v 1.50 2005/06/09 20:20:30 ssouhlal Exp $\n" \
+ " * Created from $FreeBSD: src/sys/tools/vnode_if.awk,v 1.55 2006/05/30 21:13:28 dds Exp $\n" \
" */\n" \
"\n";
@@ -178,35 +180,38 @@
"struct vnodeop_desc vop_default_desc = {\n" \
" \"default\",\n" \
" 0,\n" \
- " (void *)(uintptr_t)vop_panic,\n" \
+ " (vop_bypass_t *)vop_panic,\n" \
" NULL,\n" \
" VDESC_NO_OFFSET,\n" \
" VDESC_NO_OFFSET,\n" \
" VDESC_NO_OFFSET,\n" \
" VDESC_NO_OFFSET,\n" \
- " NULL,\n" \
"};\n");
}
while ((getline < srcfile) > 0) {
+ fnr++;
if (NF == 0)
continue;
- if ($1 ~ /^#%/) {
- if (NF != 6 || $1 != "#%" || \
- $2 !~ /^[a-z]+$/ || $3 !~ /^[a-z]+$/ || \
- $4 !~ /^.$/ || $5 !~ /^.$/ || $6 !~ /^.$/)
+ if ($1 ~ /^%%/) {
+ if (NF != 6 ||
+ $2 !~ /^[a-z]+$/ || $3 !~ /^[a-z]+$/ ||
+ $4 !~ /^.$/ || $5 !~ /^.$/ || $6 !~ /^.$/) {
+ die("Invalid %s construction", "%%");
continue;
+ }
lockdata["vop_" $2, $3, "Entry"] = $4;
lockdata["vop_" $2, $3, "OK"] = $5;
lockdata["vop_" $2, $3, "Error"] = $6;
continue;
}
- if ($1 ~ /^#!/) {
- if (NF != 4 || $1 != "#!")
- continue;
- if ($3 != "pre" && $3 != "post")
+ if ($1 ~ /^%!/) {
+ if (NF != 4 ||
+ ($3 != "pre" && $3 != "post")) {
+ die("Invalid %s construction", "%!");
continue;
+ }
lockdata["vop_" $2, $3] = $4;
continue;
}
@@ -225,6 +230,7 @@
die("Unable to read through the arguments for \"%s\"",
name);
}
+ fnr++;
if ($1 ~ /^\};/)
break;
@@ -401,7 +407,7 @@
printc("\t" releflags vppwillrele ",");
# function to call
- printc("\t(void*)(uintptr_t)" uname "_AP,");
+ printc("\t(vop_bypass_t *)" uname "_AP,");
# vp offsets
printc("\t" name "_vp_offsets,");
# vpp (if any)
@@ -413,7 +419,7 @@
# componentname
printc("\t" find_arg_with_type("struct componentname *") ",");
# transport layer information
- printc("\tNULL,\n};\n");
+ printc("};\n");
}
}
More information about the Midnightbsd-cvs
mailing list