1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 1991-1996, 1999, 2001-2003 Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  * Use is subject to license terms.
26*0Sstevel@tonic-gate  */
27*0Sstevel@tonic-gate /*
28*0Sstevel@tonic-gate  * Copyright 1991-1996, 1999, 2001-2002 Sun Microsystems, Inc.
29*0Sstevel@tonic-gate  * All rights reserved.
30*0Sstevel@tonic-gate  * Use is subject to license terms.
31*0Sstevel@tonic-gate  */
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate /*
36*0Sstevel@tonic-gate  * This file contains the declarations of menus for the program.  To add
37*0Sstevel@tonic-gate  * a new command/menu, simply add it to the appropriate table and define
38*0Sstevel@tonic-gate  * the function that executes it.
39*0Sstevel@tonic-gate  */
40*0Sstevel@tonic-gate #include <sys/isa_defs.h>
41*0Sstevel@tonic-gate #include "global.h"
42*0Sstevel@tonic-gate #include "menu.h"
43*0Sstevel@tonic-gate #include "menu_partition.h"
44*0Sstevel@tonic-gate #include "menu_command.h"
45*0Sstevel@tonic-gate #include "menu_analyze.h"
46*0Sstevel@tonic-gate #include "menu_defect.h"
47*0Sstevel@tonic-gate #include "add_definition.h"
48*0Sstevel@tonic-gate #include "menu_scsi.h"
49*0Sstevel@tonic-gate #include "menu_developer.h"
50*0Sstevel@tonic-gate #include "menu_cache.h"
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate #include "menu_fdisk.h"
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate /*
56*0Sstevel@tonic-gate  * This declaration is for the command menu.  It is the menu first
57*0Sstevel@tonic-gate  * encountered upon entering the program.
58*0Sstevel@tonic-gate  */
59*0Sstevel@tonic-gate struct	menu_item menu_command[] = {
60*0Sstevel@tonic-gate 	{ "disk       - select a disk",
61*0Sstevel@tonic-gate 		c_disk, true },
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate 	{ "type       - select (define) a disk type",
64*0Sstevel@tonic-gate 		c_type, true },
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate 	{ "partition  - select (define) a partition table",
67*0Sstevel@tonic-gate 		c_partition, true },
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate 	{ "current    - describe the current disk",
70*0Sstevel@tonic-gate 		c_current, true },
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate 	{ "format     - format and analyze the disk",
73*0Sstevel@tonic-gate 		c_format, true },
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate 	{ "fdisk      - run the fdisk program",
76*0Sstevel@tonic-gate 		c_fdisk, support_fdisk_on_sparc },
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate 	{ "repair     - repair a defective sector",
79*0Sstevel@tonic-gate 		c_repair, true },
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate 	{ "show       - translate a disk address",
82*0Sstevel@tonic-gate 		c_show,	 not_scsi },
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate 	{ "label      - write label to the disk",
85*0Sstevel@tonic-gate 		c_label, true },
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate 	{ "analyze    - surface analysis",
88*0Sstevel@tonic-gate 		c_analyze, true },
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate 	{ "defect     - defect list management",
91*0Sstevel@tonic-gate 		c_defect, true },
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate 	{ "backup     - search for backup labels",
94*0Sstevel@tonic-gate 		c_backup, true },
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate 	{ "verify     - read and display labels",
97*0Sstevel@tonic-gate 		c_verify, true },
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate 	{ "save       - save new disk/partition definitions",
100*0Sstevel@tonic-gate 		add_definition, not_efi },
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate 	{ "inquiry    - show vendor, product and revision",
103*0Sstevel@tonic-gate 		c_inquiry, scsi },
104*0Sstevel@tonic-gate 
105*0Sstevel@tonic-gate 	{ "scsi       - independent SCSI mode selects",
106*0Sstevel@tonic-gate 		c_scsi, scsi_expert },
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate 	{ "cache      - enable, disable or query SCSI disk cache",
109*0Sstevel@tonic-gate 		c_cache, scsi_expert },
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate 	{ "volname    - set 8-character volume name",
112*0Sstevel@tonic-gate 		c_volname, true },
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate 	{ "developer  - dump developer things",
115*0Sstevel@tonic-gate 		c_developer, developer },
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate 	{ "!<cmd>     - execute <cmd>, then return",
118*0Sstevel@tonic-gate 		execute_shell, true},
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate 	{ NULL }
121*0Sstevel@tonic-gate };
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate /*
125*0Sstevel@tonic-gate  * This declaration is for the partition menu.  It is used to create
126*0Sstevel@tonic-gate  * and maintain partition tables.
127*0Sstevel@tonic-gate  */
128*0Sstevel@tonic-gate struct	menu_item menu_partition[] = {
129*0Sstevel@tonic-gate 	{ "0      - change `0' partition",
130*0Sstevel@tonic-gate 		p_apart, true },
131*0Sstevel@tonic-gate 	{ "1      - change `1' partition",
132*0Sstevel@tonic-gate 		p_bpart, true },
133*0Sstevel@tonic-gate 	{ "2      - change `2' partition",
134*0Sstevel@tonic-gate 		p_cpart, true },
135*0Sstevel@tonic-gate 	{ "3      - change `3' partition",
136*0Sstevel@tonic-gate 		p_dpart, true },
137*0Sstevel@tonic-gate 	{ "4      - change `4' partition",
138*0Sstevel@tonic-gate 		p_epart, true },
139*0Sstevel@tonic-gate 	{ "5      - change `5' partition",
140*0Sstevel@tonic-gate 		p_fpart, true },
141*0Sstevel@tonic-gate 	{ "6      - change `6' partition",
142*0Sstevel@tonic-gate 		p_gpart, true },
143*0Sstevel@tonic-gate 	{ "7      - change `7' partition",
144*0Sstevel@tonic-gate 		p_hpart, disp_expert_change_expert_efi },
145*0Sstevel@tonic-gate 	{ "8      - change '8' partition",
146*0Sstevel@tonic-gate 		p_ipart, disp_all_change_expert_efi },
147*0Sstevel@tonic-gate #if defined(i386)
148*0Sstevel@tonic-gate 	{ "9      - change `9' partition",
149*0Sstevel@tonic-gate 		p_jpart, expert },
150*0Sstevel@tonic-gate #endif
151*0Sstevel@tonic-gate 	{ "select - select a predefined table",
152*0Sstevel@tonic-gate 		p_select, true },
153*0Sstevel@tonic-gate 	{ "modify - modify a predefined partition table",
154*0Sstevel@tonic-gate 		p_modify, true },
155*0Sstevel@tonic-gate 	{ "name   - name the current table",
156*0Sstevel@tonic-gate 		p_name, true },
157*0Sstevel@tonic-gate 	{ "print  - display the current table",
158*0Sstevel@tonic-gate 		p_print, true },
159*0Sstevel@tonic-gate 	{ "label  - write partition map and label to the disk",
160*0Sstevel@tonic-gate 		c_label, true },
161*0Sstevel@tonic-gate 	{ "!<cmd> - execute <cmd>, then return",
162*0Sstevel@tonic-gate 		execute_shell, true},
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate 	{ NULL }
165*0Sstevel@tonic-gate };
166*0Sstevel@tonic-gate 
167*0Sstevel@tonic-gate 
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate /*
170*0Sstevel@tonic-gate  * This declaration is for the analysis menu.  It is used to set up
171*0Sstevel@tonic-gate  * and execute surface analysis of a disk.
172*0Sstevel@tonic-gate  */
173*0Sstevel@tonic-gate struct menu_item menu_analyze[] = {
174*0Sstevel@tonic-gate 	{ "read     - read only test   (doesn't harm SunOS)",
175*0Sstevel@tonic-gate 		a_read,	 true },
176*0Sstevel@tonic-gate 	{ "refresh  - read then write  (doesn't harm data)",
177*0Sstevel@tonic-gate 		a_refresh, true },
178*0Sstevel@tonic-gate 	{ "test     - pattern testing  (doesn't harm data)",
179*0Sstevel@tonic-gate 		a_test,	 true },
180*0Sstevel@tonic-gate 	{ "write    - write then read      (corrupts data)",
181*0Sstevel@tonic-gate 		a_write, true },
182*0Sstevel@tonic-gate 	{ "compare  - write, read, compare (corrupts data)",
183*0Sstevel@tonic-gate 		a_compare, true },
184*0Sstevel@tonic-gate 	{ "purge    - write, read, write   (corrupts data)",
185*0Sstevel@tonic-gate 		a_purge, true },
186*0Sstevel@tonic-gate 	{ "verify   - write entire disk, then verify (corrupts data)",
187*0Sstevel@tonic-gate 		a_verify, true },
188*0Sstevel@tonic-gate 	{ "print    - display data buffer",
189*0Sstevel@tonic-gate 		a_print, true },
190*0Sstevel@tonic-gate 	{ "setup    - set analysis parameters",
191*0Sstevel@tonic-gate 		a_setup, true },
192*0Sstevel@tonic-gate 	{ "config   - show analysis parameters",
193*0Sstevel@tonic-gate 		a_config, true },
194*0Sstevel@tonic-gate 	{ "!<cmd>   - execute <cmd> , then return",
195*0Sstevel@tonic-gate 		execute_shell, true},
196*0Sstevel@tonic-gate 	{ NULL }
197*0Sstevel@tonic-gate };
198*0Sstevel@tonic-gate 
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate 
201*0Sstevel@tonic-gate /*
202*0Sstevel@tonic-gate  * This declaration is for the defect menu.  It is used to manipulate
203*0Sstevel@tonic-gate  * the defect list for a disk.
204*0Sstevel@tonic-gate  */
205*0Sstevel@tonic-gate struct menu_item menu_defect[] = {
206*0Sstevel@tonic-gate 	{ "restore  - set working list = current list",
207*0Sstevel@tonic-gate 		d_restore, not_embedded_scsi },
208*0Sstevel@tonic-gate 	{ "original - extract manufacturer's list from disk",
209*0Sstevel@tonic-gate 		d_original, not_embedded_scsi },
210*0Sstevel@tonic-gate 	{ "extract  - extract working list from disk",
211*0Sstevel@tonic-gate 		d_extract, not_embedded_scsi },
212*0Sstevel@tonic-gate 	{ "primary  - extract manufacturer's defect list",
213*0Sstevel@tonic-gate 		d_primary, embedded_scsi },
214*0Sstevel@tonic-gate 	{ "grown    - extract the grown defects list",
215*0Sstevel@tonic-gate 		d_grown, embedded_scsi },
216*0Sstevel@tonic-gate 	{ "both     - extract both primary and grown defects lists",
217*0Sstevel@tonic-gate 		d_both, embedded_scsi },
218*0Sstevel@tonic-gate 	{ "add      - add defects to working list",
219*0Sstevel@tonic-gate 		d_add,	 not_embedded_scsi },
220*0Sstevel@tonic-gate 	{ "delete   - delete a defect from working list",
221*0Sstevel@tonic-gate 		d_delete, not_embedded_scsi },
222*0Sstevel@tonic-gate 	{ "print    - display defect list",
223*0Sstevel@tonic-gate 		d_print, embedded_scsi },
224*0Sstevel@tonic-gate 	{ "dump     - dump defect list to file",
225*0Sstevel@tonic-gate 		d_dump,	 embedded_scsi },
226*0Sstevel@tonic-gate 	{ "print    - display working list",
227*0Sstevel@tonic-gate 		d_print, not_embedded_scsi },
228*0Sstevel@tonic-gate 	{ "dump     - dump working list to file",
229*0Sstevel@tonic-gate 		d_dump,	 not_embedded_scsi },
230*0Sstevel@tonic-gate 	{ "load     - load working list from file",
231*0Sstevel@tonic-gate 		d_load,	 not_embedded_scsi },
232*0Sstevel@tonic-gate 	{ "commit   - set current list = working list",
233*0Sstevel@tonic-gate 		d_commit, not_embedded_scsi },
234*0Sstevel@tonic-gate 	{ "create   - recreates maufacturer's defect list on disk",
235*0Sstevel@tonic-gate 		d_create, not_embedded_scsi },
236*0Sstevel@tonic-gate 	{ "!<cmd>   - execute <cmd>, then return",
237*0Sstevel@tonic-gate 		execute_shell, true},
238*0Sstevel@tonic-gate 
239*0Sstevel@tonic-gate 	{ NULL }
240*0Sstevel@tonic-gate };
241*0Sstevel@tonic-gate 
242*0Sstevel@tonic-gate /*
243*0Sstevel@tonic-gate  * This declaration is for the developer menu.
244*0Sstevel@tonic-gate  */
245*0Sstevel@tonic-gate struct menu_item menu_developer[] = {
246*0Sstevel@tonic-gate 	{ "dump_disk  - dump disk entries",
247*0Sstevel@tonic-gate 		dv_disk, true },
248*0Sstevel@tonic-gate 	{ "dump_cont  - dump controller entries",
249*0Sstevel@tonic-gate 		dv_cont, true },
250*0Sstevel@tonic-gate 	{ "dump_c_chain - dump controller chain entries",
251*0Sstevel@tonic-gate 		dv_cont_chain, true },
252*0Sstevel@tonic-gate 	{ "dev_params - dump device parameters",
253*0Sstevel@tonic-gate 		dv_params, true },
254*0Sstevel@tonic-gate 	{ "!<cmd>     - execute <cmd>, then return",
255*0Sstevel@tonic-gate 		execute_shell, true},
256*0Sstevel@tonic-gate 	{ NULL }
257*0Sstevel@tonic-gate };
258*0Sstevel@tonic-gate 
259*0Sstevel@tonic-gate /*
260*0Sstevel@tonic-gate  * This declaration is for the cache menu.
261*0Sstevel@tonic-gate  */
262*0Sstevel@tonic-gate struct menu_item menu_cache[] = {
263*0Sstevel@tonic-gate 	{ "write_cache - display or modify write cache settings",
264*0Sstevel@tonic-gate 		ca_write_cache, scsi_expert },
265*0Sstevel@tonic-gate 	{ "read_cache  - display or modify read cache settings",
266*0Sstevel@tonic-gate 		ca_read_cache,  scsi_expert },
267*0Sstevel@tonic-gate 	{ "!<cmd>      - execute <cmd>, then return",
268*0Sstevel@tonic-gate 		execute_shell, true},
269*0Sstevel@tonic-gate 	{ NULL }
270*0Sstevel@tonic-gate };
271*0Sstevel@tonic-gate 
272*0Sstevel@tonic-gate /*
273*0Sstevel@tonic-gate  * This declaration is for the write_cache menu.
274*0Sstevel@tonic-gate  */
275*0Sstevel@tonic-gate struct menu_item menu_write_cache[] = {
276*0Sstevel@tonic-gate 	{ "display     - display current setting of write cache",
277*0Sstevel@tonic-gate 		ca_write_display, scsi_expert },
278*0Sstevel@tonic-gate 	{ "enable      - enable write cache",
279*0Sstevel@tonic-gate 		ca_write_enable,  scsi_expert },
280*0Sstevel@tonic-gate 	{ "disable     - disable write cache",
281*0Sstevel@tonic-gate 		ca_write_disable, scsi_expert },
282*0Sstevel@tonic-gate 	{ "!<cmd>      - execute <cmd>, then return",
283*0Sstevel@tonic-gate 		execute_shell, true},
284*0Sstevel@tonic-gate 	{ NULL }
285*0Sstevel@tonic-gate };
286*0Sstevel@tonic-gate 
287*0Sstevel@tonic-gate /*
288*0Sstevel@tonic-gate  * This declaration is for the read_cache menu.
289*0Sstevel@tonic-gate  */
290*0Sstevel@tonic-gate struct menu_item menu_read_cache[] = {
291*0Sstevel@tonic-gate 	{ "display     - display current setting of read cache",
292*0Sstevel@tonic-gate 		ca_read_display, scsi_expert },
293*0Sstevel@tonic-gate 	{ "enable      - enable read cache",
294*0Sstevel@tonic-gate 		ca_read_enable,  scsi_expert },
295*0Sstevel@tonic-gate 	{ "disable     - disable read cache",
296*0Sstevel@tonic-gate 		ca_read_disable, scsi_expert },
297*0Sstevel@tonic-gate 	{ "!<cmd>      - execute <cmd>, then return",
298*0Sstevel@tonic-gate 		execute_shell, true},
299*0Sstevel@tonic-gate 	{ NULL }
300*0Sstevel@tonic-gate };
301