xref: /openbsd-src/sys/arch/octeon/stand/rdboot/cmd.h (revision 3a62b615e8a99ae852ef9000d03e4dc04e13301f)
1*3a62b615Svisa /*	$OpenBSD: cmd.h,v 1.1 2019/07/17 14:36:32 visa Exp $	*/
2*3a62b615Svisa 
3*3a62b615Svisa /*
4*3a62b615Svisa  * Copyright (c) 1997 Michael Shalayeff
5*3a62b615Svisa  * All rights reserved.
6*3a62b615Svisa  *
7*3a62b615Svisa  * Redistribution and use in source and binary forms, with or without
8*3a62b615Svisa  * modification, are permitted provided that the following conditions
9*3a62b615Svisa  * are met:
10*3a62b615Svisa  * 1. Redistributions of source code must retain the above copyright
11*3a62b615Svisa  *    notice, this list of conditions and the following disclaimer.
12*3a62b615Svisa  * 2. Redistributions in binary form must reproduce the above copyright
13*3a62b615Svisa  *    notice, this list of conditions and the following disclaimer in the
14*3a62b615Svisa  *    documentation and/or other materials provided with the distribution.
15*3a62b615Svisa  *
16*3a62b615Svisa  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*3a62b615Svisa  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18*3a62b615Svisa  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*3a62b615Svisa  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20*3a62b615Svisa  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*3a62b615Svisa  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*3a62b615Svisa  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*3a62b615Svisa  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*3a62b615Svisa  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*3a62b615Svisa  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*3a62b615Svisa  * SUCH DAMAGE.
27*3a62b615Svisa  *
28*3a62b615Svisa  */
29*3a62b615Svisa 
30*3a62b615Svisa #define CMD_BUFF_SIZE		133
31*3a62b615Svisa #define BOOTDEVLEN		1024
32*3a62b615Svisa 
33*3a62b615Svisa struct cmd_table {
34*3a62b615Svisa 	char *cmd_name;
35*3a62b615Svisa 	char cmd_type;
36*3a62b615Svisa #define CMDT_CMD 0
37*3a62b615Svisa #define CMDT_VAR 1
38*3a62b615Svisa #define CMDT_SET 2
39*3a62b615Svisa #define CMDT_MDC 3
40*3a62b615Svisa 	int (*cmd_exec)(void);
41*3a62b615Svisa };
42*3a62b615Svisa 
43*3a62b615Svisa struct cmd_state {
44*3a62b615Svisa 	char bootdev[BOOTDEVLEN]; /* device */
45*3a62b615Svisa 	char image[MAXPATHLEN - 16]; /* image */
46*3a62b615Svisa 	unsigned char bootduid[8]; /* duid of root disk */
47*3a62b615Svisa 	int boothowto; /* howto */
48*3a62b615Svisa 	int hasduid;
49*3a62b615Svisa 	char *conf; /* /etc/boot.conf normally */
50*3a62b615Svisa 	int timeout;
51*3a62b615Svisa 
52*3a62b615Svisa 	char path[MAXPATHLEN]; /* buffer for pathname compose */
53*3a62b615Svisa 	const struct cmd_table *cmd;
54*3a62b615Svisa 	int argc;
55*3a62b615Svisa 	char *argv[8];	/* XXX i hope this is enough */
56*3a62b615Svisa };
57*3a62b615Svisa extern struct cmd_state cmd;
58*3a62b615Svisa 
59*3a62b615Svisa int getcmd(void);
60*3a62b615Svisa int read_conf(void);
61*3a62b615Svisa int bootparse(int);
62*3a62b615Svisa void boot(dev_t);
63*3a62b615Svisa 
64*3a62b615Svisa int upgrade(void);
65*3a62b615Svisa int docmd(void);		/* No longer static: needed by regress test */
66