xref: /onnv-gate/usr/src/uts/common/avs/ns/sdbc/sd_mkiob.sh (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM#!/usr/bin/sh
2*7836SJohn.Forte@Sun.COM# CDDL HEADER START
3*7836SJohn.Forte@Sun.COM#
4*7836SJohn.Forte@Sun.COM# The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM# Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM# You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM#
8*7836SJohn.Forte@Sun.COM# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM# or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM# See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM# and limitations under the License.
12*7836SJohn.Forte@Sun.COM#
13*7836SJohn.Forte@Sun.COM# When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM# If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM# fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM# information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM#
19*7836SJohn.Forte@Sun.COM# CDDL HEADER END
20*7836SJohn.Forte@Sun.COM#
21*7836SJohn.Forte@Sun.COM#
22*7836SJohn.Forte@Sun.COM# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM# Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM#
25*7836SJohn.Forte@Sun.COM# Build-time script to generate the sd_iob_implX.c files.
26*7836SJohn.Forte@Sun.COM#
27*7836SJohn.Forte@Sun.COMSTART="$1"
28*7836SJohn.Forte@Sun.COMEND="$2"
29*7836SJohn.Forte@Sun.COMFILE="$3"
30*7836SJohn.Forte@Sun.COM
31*7836SJohn.Forte@Sun.COMawk '
32*7836SJohn.Forte@Sun.COM/#define.*_SD_DEFAULT_IOBUFS/ {
33*7836SJohn.Forte@Sun.COM	num = $3;
34*7836SJohn.Forte@Sun.COMprintf("/* start = %d, end = %d, num %d */\n", start, end, num);
35*7836SJohn.Forte@Sun.COM	if (num > end) {
36*7836SJohn.Forte@Sun.COM		num = end;
37*7836SJohn.Forte@Sun.COM	}
38*7836SJohn.Forte@Sun.COMprintf("/* start = %d, end = %d, num %d */\n", start, end, num);
39*7836SJohn.Forte@Sun.COM}
40*7836SJohn.Forte@Sun.COM
41*7836SJohn.Forte@Sun.COMEND {
42*7836SJohn.Forte@Sun.COM	printf("/* start = %d, end = %d, num %d */\n", start, end, num);
43*7836SJohn.Forte@Sun.COM	printf("#include <sys/types.h>\n");
44*7836SJohn.Forte@Sun.COM	printf("#include <sys/param.h>\n");
45*7836SJohn.Forte@Sun.COM	printf("#include <sys/ksynch.h>\n");
46*7836SJohn.Forte@Sun.COM	printf("#include <sys/kmem.h>\n");
47*7836SJohn.Forte@Sun.COM	printf("#include <sys/stat.h>\n");
48*7836SJohn.Forte@Sun.COM	printf("#include <sys/buf.h>\n");
49*7836SJohn.Forte@Sun.COM	printf("#include <sys/open.h>\n");
50*7836SJohn.Forte@Sun.COM	printf("#include <sys/conf.h>\n");
51*7836SJohn.Forte@Sun.COM	printf("#include <sys/file.h>\n");
52*7836SJohn.Forte@Sun.COM	printf("#include <sys/cmn_err.h>\n");
53*7836SJohn.Forte@Sun.COM	printf("#include <sys/errno.h>\n");
54*7836SJohn.Forte@Sun.COM	printf("#include <sys/debug.h>\n");
55*7836SJohn.Forte@Sun.COM	printf("#include <sys/ddi.h>\n");
56*7836SJohn.Forte@Sun.COM	printf("#include <sys/nsc_thread.h>\n");
57*7836SJohn.Forte@Sun.COM	printf("#include <sys/nsctl/sd_bcache.h>\n");
58*7836SJohn.Forte@Sun.COM	printf("#include <sys/nsctl/sd_trace.h>\n");
59*7836SJohn.Forte@Sun.COM	printf("#include <ns/sdbc/sd_io.h>\n");
60*7836SJohn.Forte@Sun.COM	printf("#include <ns/sdbc/sd_iob.h>\n");
61*7836SJohn.Forte@Sun.COM
62*7836SJohn.Forte@Sun.COM	n = start;
63*7836SJohn.Forte@Sun.COM	while (n < num) {
64*7836SJohn.Forte@Sun.COM		printf("IOB_DCB(%d)", n);
65*7836SJohn.Forte@Sun.COM		n = n + 1;
66*7836SJohn.Forte@Sun.COM
67*7836SJohn.Forte@Sun.COM		if (n % 4) {
68*7836SJohn.Forte@Sun.COM			printf(" ");
69*7836SJohn.Forte@Sun.COM		} else {
70*7836SJohn.Forte@Sun.COM			printf("\n");
71*7836SJohn.Forte@Sun.COM			if (!((n - start) % 2048) && (n < num))
72*7836SJohn.Forte@Sun.COM				printf("static int _cscope_brkline%d;\n", n);
73*7836SJohn.Forte@Sun.COM		}
74*7836SJohn.Forte@Sun.COM	}
75*7836SJohn.Forte@Sun.COM}' start=$START end=$END incdir=`dirname $FILE` $FILE
76*7836SJohn.Forte@Sun.COM
77*7836SJohn.Forte@Sun.COMexit 0
78