1  /*
       2   * Mach Operating System
       3   * Copyright (C) 1993,1991,1990 Carnegie Mellon University
       4   * All Rights Reserved.
       5   *
       6   * Permission to use, copy, modify and distribute this software and its
       7   * documentation is hereby granted, provided that both the copyright
       8   * notice and this permission notice appear in all copies of the
       9   * software, derivative works or modified versions, and any portions
      10   * thereof, and that both notices appear in supporting documentation.
      11   *
      12   * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
      13   * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
      14   * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
      15   *
      16   * Carnegie Mellon requests users of this software to return to
      17   *
      18   *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
      19   *  School of Computer Science
      20   *  Carnegie Mellon University
      21   *  Pittsburgh PA 15213-3890
      22   *
      23   * any improvements or extensions that they make and grant Carnegie Mellon
      24   * the rights to redistribute these changes.
      25   */
      26  /*
      27   * (pre-GNU) HISTORY
      28   *
      29   * Revision 2.8  93/03/11  13:46:40  danner
      30   * 	unsigned long -> unsigned int.
      31   * 	[93/03/09            danner]
      32   *
      33   * Revision 2.7  92/05/21  17:25:11  jfriedl
      34   * 	Appended 'U' to constants that would otherwise be signed.
      35   * 	[92/05/16            jfriedl]
      36   *
      37   * Revision 2.6  91/06/19  11:59:44  rvb
      38   * 	Second byte of boothowto is flags for "startup" program.
      39   * 	[91/06/18            rvb]
      40   * 	Add ifndef __ASSEMBLER__ so that vax_init.s can include it.
      41   * 	[91/06/11            rvb]
      42   *
      43   * Revision 2.5  91/05/14  17:40:11  mrt
      44   * 	Correcting copyright
      45   *
      46   * Revision 2.4  91/02/05  17:56:48  mrt
      47   * 	Changed to new Mach copyright
      48   * 	[91/02/01  17:49:12  mrt]
      49   *
      50   * Revision 2.3  90/08/27  22:12:56  dbg
      51   * 	Added definitions used by Mach Kernel: RB_DEBUGGER, RB_UNIPROC,
      52   * 	RB_NOBOOTRC, RB_ALTBOOT.  Moved RB_KDB to 0x04 (Mach value).
      53   * 	Removed RB_RDONLY, RB_DUMP, RB_NOSYNC.
      54   * 	[90/08/14            dbg]
      55   *
      56   */
      57  
      58  /*
      59     Copyright (C) 1982, 1986, 1988 Regents of the University of California.
      60     All rights reserved.
      61  
      62     Redistribution and use in source and binary forms, with or without
      63     modification, are permitted provided that the following conditions
      64     are met:
      65  
      66     1. Redistributions of source code must retain the above copyright
      67        notice, this list of conditions and the following disclaimer.
      68     2. Redistributions in binary form must reproduce the above copyright
      69        notice, this list of conditions and the following disclaimer in the
      70        documentation and/or other materials provided with the distribution.
      71     4. Neither the name of the University nor the names of its contributors
      72        may be used to endorse or promote products derived from this software
      73        without specific prior written permission.
      74  
      75     THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
      76     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      77     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      78     ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
      79     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      80     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      81     OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      82     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      83     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      84     OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      85     SUCH DAMAGE.*/
      86  
      87  /*
      88   *	@(#)reboot.h	7.5 (Berkeley) 6/27/88
      89   */
      90  
      91  #ifndef	_SYS_REBOOT_H_
      92  #define	_SYS_REBOOT_H_
      93  
      94  #include <features.h>
      95  
      96  /*
      97   * Arguments to reboot system call.
      98   * These are converted to switches, and passed to startup program,
      99   * and on to init.
     100   */
     101  #define	RB_AUTOBOOT	0	/* flags for system auto-booting itself */
     102  
     103  #define	RB_ASKNAME	0x01	/* -a: ask for file name to reboot from */
     104  #define	RB_SINGLE	0x02	/* -s: reboot to single user only */
     105  #define	RB_KDB		0x04	/* -d: kernel debugger symbols loaded */
     106  #define	RB_HALT		0x08	/* -h: enter KDB at bootup */
     107  				/*     for host_reboot(): don't reboot,
     108  				       just halt */
     109  #define	RB_INITNAME	0x10	/* -i: name given for /etc/init (unused) */
     110  #define	RB_DFLTROOT	0x20	/*     use compiled-in rootdev */
     111  #define	RB_NOBOOTRC	0x20	/* -b: don't run /etc/rc.boot */
     112  #define RB_ALTBOOT	0x40	/*     use /boot.old vs /boot */
     113  #define	RB_UNIPROC	0x80	/* -u: start only one processor */
     114  
     115  #define	RB_SHIFT	8	/* second byte is for ux */
     116  
     117  #define	RB_DEBUGGER	0x1000	/*     for host_reboot(): enter kernel
     118  				       debugger from user level */
     119  
     120  /*
     121   * Constants for converting boot-style device number to type,
     122   * adaptor (uba, mba, etc), unit number and partition number.
     123   * Type (== major device number) is in the low byte
     124   * for backward compatibility.  Except for that of the "magic
     125   * number", each mask applies to the shifted value.
     126   * Format:
     127   *	 (4) (4) (4) (4)  (8)     (8)
     128   *	--------------------------------
     129   *	|MA | AD| CT| UN| PART  | TYPE |
     130   *	--------------------------------
     131   */
     132  #define	B_ADAPTORSHIFT		24
     133  #define	B_ADAPTORMASK		0x0f
     134  #define	B_ADAPTOR(val)		(((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
     135  #define B_CONTROLLERSHIFT	20
     136  #define B_CONTROLLERMASK	0xf
     137  #define	B_CONTROLLER(val)	(((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
     138  #define B_UNITSHIFT		16
     139  #define B_UNITMASK		0xf
     140  #define	B_UNIT(val)		(((val) >> B_UNITSHIFT) & B_UNITMASK)
     141  #define B_PARTITIONSHIFT	8
     142  #define B_PARTITIONMASK		0xff
     143  #define	B_PARTITION(val)	(((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
     144  #define	B_TYPESHIFT		0
     145  #define	B_TYPEMASK		0xff
     146  #define	B_TYPE(val)		(((val) >> B_TYPESHIFT) & B_TYPEMASK)
     147  
     148  #define	B_MAGICMASK	0xf0000000U
     149  #define	B_DEVMAGIC	0xa0000000U
     150  
     151  #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
     152  	(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
     153  	((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
     154  	((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
     155  
     156  
     157  #ifdef	KERNEL
     158  #ifndef	__ASSEMBLER__
     159  extern int boothowto;
     160  #endif	/* __ASSEMBLER__ */
     161  #endif
     162  
     163  __BEGIN_DECLS
     164  
     165  /* Reboot or halt the system.  */
     166  extern int reboot (int __howto) __THROW;
     167  
     168  __END_DECLS
     169  
     170  
     171  #endif	/* _SYS_REBOOT_H_ */