1 /**	$MirOS: src/sys/stand/boot/cmd.h,v 1.15 2009/10/27 13:37:27 tg Exp $ */
2 /*	$OpenBSD: cmd.h,v 1.16 2007/06/13 02:17:32 drahn Exp $	*/
3 
4 /*
5  * Copyright (c) 1997 Michael Shalayeff
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  */
30 
31 #define CMD_BUFF_SIZE		256
32 /* sizeof(struct cmd_state), approx. 0x8C8 */
33 #define CMD_STRUCT_SIZE		0x0900
34 
35 #ifndef _ASM_SOURCE
36 #define BOOTDEVLEN		64 /* 1024 */
37 
38 struct cmd_table {
39 	char *cmd_name;
40 	char cmd_type;
41 #define CMDT_CMD 0
42 #define CMDT_VAR 1
43 #define CMDT_SET 2
44 #define CMDT_MDC 3
45 #define CMDT_MAC 4
46 #define CMDT_EOL 5
47 	int (*cmd_exec)(void);
48 };
49 
50 #ifndef CMD_TABLE_ONLY
51 /* WARNING: defined in srt0.S – fix it if changing! */
52 struct cmd_state {
53 	char bootdev[BOOTDEVLEN]; /* device */
54 	char image[MAXPATHLEN - 16]; /* image */
55 	int  boothowto; /* howto */
56 	char *conf; /* /boot.cfg normally */
57 	void *addr; /* load here */
58 	int timeout;
59 
60 	char path[MAXPATHLEN]; /* buffer for pathname compose */
61 	const struct cmd_table *cmd;
62 	int argc;
63 #ifndef	__MirBSD__
64 	char *argv[8];	/* XXX i hope this is enough */
65 #else
66 	char *argv[32];	/* no Mickey, see the "echo" command */
67 #endif
68 };
69 extern struct cmd_state cmd;
70 extern char cmd_buf[CMD_BUFF_SIZE];
71 
72 int getcmd(void);
73 int read_conf(void);
74 int bootparse(int);
75 void boot(dev_t);
76 
77 int docmd(void);		/* No longer static: needed by regress test */
78 char *qualify(char *);		/* No longer static: needed by cmd_*.c */
79 #endif
80 #endif
81