4 struct file_list *file;
48 %type <str> device_name
53 * Copyright (c) 1988, 1993
54 * The Regents of the University of California. All rights reserved.
56 * Redistribution and use in source and binary forms, with or without
57 * modification, are permitted provided that the following conditions
59 * 1. Redistributions of source code must retain the above copyright
60 * notice, this list of conditions and the following disclaimer.
61 * 2. Redistributions in binary form must reproduce the above copyright
62 * notice, this list of conditions and the following disclaimer in the
63 * documentation and/or other materials provided with the distribution.
64 * 3. All advertising materials mentioning features or use of this software
65 * must display the following acknowledgement:
66 * This product includes software developed by the University of
67 * California, Berkeley and its contributors.
68 * 4. Neither the name of the University nor the names of its contributors
69 * may be used to endorse or promote products derived from this software
70 * without specific prior written permission.
72 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
73 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
74 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
75 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
76 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
77 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
78 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
79 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
80 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
81 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
84 * @(#)config.y 8.1 (Berkeley) 6/6/93
85 * $FreeBSD: src/usr.sbin/config/config.y,v 1.42.2.1 2001/01/23 00:09:32 peter Exp $
86 * $DragonFly: src/usr.sbin/config/config.y,v 1.3 2003/11/03 19:31:36 eirikn Exp $
96 static struct device cur;
97 static struct device *curp = 0;
102 struct file_list *ftab;
106 #define ns(s) strdup(s)
108 static int connect(char *, int);
109 static void yyerror(char *s);
125 Device_spec SEMICOLON
126 = { newdev(&cur); } |
127 Config_spec SEMICOLON
137 if (!strcmp($2, "i386")) {
138 machine = MACHINE_I386;
139 machinename = "i386";
140 } else if (!strcmp($2, "pc98")) {
141 machine = MACHINE_PC98;
142 machinename = "pc98";
143 } else if (!strcmp($2, "alpha")) {
144 machine = MACHINE_ALPHA;
145 machinename = "alpha";
147 yyerror("Unknown machine type");
152 (struct cputype *)malloc(sizeof (struct cputype));
153 memset(cp, 0, sizeof(*cp));
155 cp->cpu_next = cputype;
160 MAKEOPTIONS Mkopt_list
167 = { maxusers = $2; };
170 CONFIG System_id System_parameter_list
171 = { errx(1,"line %d: root/dump/swap specifications obsolete", yyline);}
179 struct opt *op = (struct opt *)malloc(sizeof (struct opt));
180 memset(op, 0, sizeof(*op));
181 op->op_name = ns("KERNEL");
185 op->op_line = yyline + 1;
189 System_parameter_list:
190 System_parameter_list ID
201 (void) snprintf(buf, sizeof(buf), "%s%d", $1, $2);
202 $$ = ns(buf); free($1);
208 (void) snprintf(buf, sizeof(buf), "%s%d%s", $1, $2, $3);
209 $$ = ns(buf); free($1);
211 | Save_id NUMBER ID NUMBER
215 (void) snprintf(buf, sizeof(buf), "%s%d%s%d",
217 $$ = ns(buf); free($1);
219 | Save_id NUMBER ID NUMBER ID
223 (void) snprintf(buf, sizeof(buf), "%s%d%s%d%s",
225 $$ = ns(buf); free($1);
230 Opt_list COMMA Option
238 struct opt *op = (struct opt *)malloc(sizeof (struct opt));
240 memset(op, 0, sizeof(*op));
245 * op->op_line is 1-based; yyline is 0-based but is now 1
246 * larger than when `Save_id' was lexed.
248 op->op_line = yyline;
250 if ((s = strchr(op->op_name, '=')))
251 errx(1, "line %d: The `=' in options should not be quoted", yyline);
253 Save_id EQUALS Opt_value
255 struct opt *op = (struct opt *)malloc(sizeof (struct opt));
256 memset(op, 0, sizeof(*op));
260 op->op_line = yyline + 1;
271 (void) snprintf(buf, sizeof(buf), "%d", $1);
281 Mkopt_list COMMA Mkoption
287 Save_id EQUALS Opt_value
289 struct opt *op = (struct opt *)malloc(sizeof (struct opt));
290 memset(op, 0, sizeof(*op));
292 op->op_ownfile = 0; /* for now */
295 op->op_line = yyline + 1;
306 = { cur.d_type = DEVICE; } |
309 errx(1, "line %d: Obsolete keyword 'disk' found - use 'device'", yyline);
313 errx(1, "line %d: Obsolete keyword 'tape' found - use 'device'", yyline);
317 errx(1, "line %d: Obsolete keyword 'controller' found - use 'device'", yyline);
319 PSEUDO_DEVICE Init_dev Dev
322 cur.d_type = PSEUDO_DEVICE;
324 PSEUDO_DEVICE Init_dev Dev NUMBER
327 cur.d_type = PSEUDO_DEVICE;
335 cur.d_unit = UNKNOWN;
337 Init_dev Dev NUMBER Dev_info
345 = { init_dev(&cur); };
362 cur.d_conn = "nexus";
373 BUS NUMBER /* device scbus1 at ahc0 bus 1 - twin channel */
374 = { cur.d_bus = $2; } |
376 = { cur.d_target = $2; } |
378 = { cur.d_lun = $2; } |
380 = { cur.d_drive = $2; } |
382 = { cur.d_irq = $2; } |
384 = { cur.d_drq = $2; } |
386 = { cur.d_maddr = $2; } |
388 = { cur.d_msize = $2; } |
390 = { cur.d_port = $2; } |
392 = { cur.d_portn = $2; } |
394 = { cur.d_flags = $2; } |
396 = { cur.d_disabled = 1; } |
399 errx(1, "line %d: Obsolete keyword 'conflicts' found", yyline);
409 errx(1, "line %d: %s", yyline + 1, s);
413 * add a device to the list of devices
417 register struct device *dp;
419 register struct device *np, *xp;
421 if (dp->d_unit >= 0) {
422 for (xp = dtab; xp != 0; xp = xp->d_next) {
423 if ((xp->d_unit == dp->d_unit) &&
424 eq(xp->d_name, dp->d_name)) {
425 errx(1, "line %d: already seen device %s%d",
426 yyline, xp->d_name, xp->d_unit);
430 np = (struct device *) malloc(sizeof *np);
431 memset(np, 0, sizeof(*np));
443 * find the pointer to connect to the given device and number.
444 * returns 0 if no such device and prints an error message
451 register struct device *dp;
454 for (dp = dtab; dp != 0; dp = dp->d_next)
455 if (eq(dp->d_name, dev))
458 (void) snprintf(errbuf, sizeof(errbuf),
459 "no %s's to wildcard", dev);
465 for (dp = dtab; dp != 0; dp = dp->d_next) {
466 if ((num != dp->d_unit) || !eq(dev, dp->d_name))
468 if (dp->d_type != DEVICE) {
469 (void) snprintf(errbuf, sizeof(errbuf),
470 "%s connected to non-device", dev);
476 (void) snprintf(errbuf, sizeof(errbuf), "%s %d not defined", dev, num);
483 register struct device *dp;
486 dp->d_name = "OHNO!!!";
491 dp->d_bus = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = \
492 dp->d_count = UNKNOWN;
493 dp->d_port = (char *)0;