17c478bd9Sstevel@tonic-gate 
27c478bd9Sstevel@tonic-gate /*
37c478bd9Sstevel@tonic-gate  *  GRUB  --  GRand Unified Bootloader
47c478bd9Sstevel@tonic-gate  *  Copyright (C) 2001  Free Software Foundation, Inc.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  *  This program is free software; you can redistribute it and/or modify
77c478bd9Sstevel@tonic-gate  *  it under the terms of the GNU General Public License as published by
87c478bd9Sstevel@tonic-gate  *  the Free Software Foundation; either version 2 of the License, or
97c478bd9Sstevel@tonic-gate  *  (at your option) any later version.
107c478bd9Sstevel@tonic-gate  *
117c478bd9Sstevel@tonic-gate  *  This program is distributed in the hope that it will be useful,
127c478bd9Sstevel@tonic-gate  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
137c478bd9Sstevel@tonic-gate  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
147c478bd9Sstevel@tonic-gate  *  GNU General Public License for more details.
157c478bd9Sstevel@tonic-gate  *
167c478bd9Sstevel@tonic-gate  *  You should have received a copy of the GNU General Public License
177c478bd9Sstevel@tonic-gate  *  along with this program; if not, write to the Free Software
187c478bd9Sstevel@tonic-gate  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
197c478bd9Sstevel@tonic-gate  */
207c478bd9Sstevel@tonic-gate 
217c478bd9Sstevel@tonic-gate /* command-line parameter defines */
227c478bd9Sstevel@tonic-gate #define RB_ASKNAME      0x01	/* ask for file name to reboot from */
237c478bd9Sstevel@tonic-gate #define RB_SINGLE       0x02	/* reboot to single user only */
247c478bd9Sstevel@tonic-gate #define RB_NOSYNC       0x04	/* dont sync before reboot */
257c478bd9Sstevel@tonic-gate #define RB_HALT         0x08	/* don't reboot, just halt */
267c478bd9Sstevel@tonic-gate #define RB_INITNAME     0x10	/* name given for /etc/init (unused) */
277c478bd9Sstevel@tonic-gate #define RB_DFLTROOT     0x20	/* use compiled-in rootdev */
287c478bd9Sstevel@tonic-gate #define RB_KDB          0x40	/* give control to kernel debugger */
297c478bd9Sstevel@tonic-gate #define RB_RDONLY       0x80	/* mount root fs read-only */
307c478bd9Sstevel@tonic-gate #define RB_DUMP         0x100	/* dump kernel memory before reboot */
317c478bd9Sstevel@tonic-gate #define RB_MINIROOT     0x200	/* mini-root present in memory at boot time */
327c478bd9Sstevel@tonic-gate #define RB_CONFIG       0x400	/* invoke user configuration routing */
337c478bd9Sstevel@tonic-gate #define RB_VERBOSE      0x800	/* print all potentially useful info */
347c478bd9Sstevel@tonic-gate #define RB_SERIAL       0x1000	/* user serial port as console */
357c478bd9Sstevel@tonic-gate #define RB_CDROM        0x2000	/* use cdrom as root */
367c478bd9Sstevel@tonic-gate #define RB_GDB		0x8000	/* use GDB remote debugger instead of DDB */
377c478bd9Sstevel@tonic-gate #define RB_MUTE		0x10000	/* Come up with the console muted */
387c478bd9Sstevel@tonic-gate #define RB_MULTIPLE	0x20000000	/* Use multiple consoles */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define RB_BOOTINFO     0x80000000	/* have `struct bootinfo *' arg */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Constants for converting boot-style device number to type,
447c478bd9Sstevel@tonic-gate  * adaptor (uba, mba, etc), unit number and partition number.
457c478bd9Sstevel@tonic-gate  * Type (== major device number) is in the low byte
467c478bd9Sstevel@tonic-gate  * for backward compatibility.  Except for that of the "magic
477c478bd9Sstevel@tonic-gate  * number", each mask applies to the shifted value.
487c478bd9Sstevel@tonic-gate  * Format:
497c478bd9Sstevel@tonic-gate  *       (4) (4) (4) (4)  (8)     (8)
507c478bd9Sstevel@tonic-gate  *      --------------------------------
517c478bd9Sstevel@tonic-gate  *      |MA | AD| CT| UN| PART  | TYPE |
527c478bd9Sstevel@tonic-gate  *      --------------------------------
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate #define B_ADAPTORSHIFT          24
557c478bd9Sstevel@tonic-gate #define B_CONTROLLERSHIFT       20
567c478bd9Sstevel@tonic-gate #define B_UNITSHIFT             16
577c478bd9Sstevel@tonic-gate #define B_PARTITIONSHIFT        8
587c478bd9Sstevel@tonic-gate #define B_TYPESHIFT             0
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate #define B_DEVMAGIC      ((unsigned long)0xa0000000)
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
637c478bd9Sstevel@tonic-gate         (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
647c478bd9Sstevel@tonic-gate         ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
657c478bd9Sstevel@tonic-gate         ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /* Only change the version number if you break compatibility. */
697c478bd9Sstevel@tonic-gate #define BOOTINFO_VERSION        1
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define N_BIOS_GEOM             8
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate /*
747c478bd9Sstevel@tonic-gate  * A zero bootinfo field often means that there is no info available.
757c478bd9Sstevel@tonic-gate  * Flags are used to indicate the validity of fields where zero is a
767c478bd9Sstevel@tonic-gate  * normal value.
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate struct bootinfo
797c478bd9Sstevel@tonic-gate   {
807c478bd9Sstevel@tonic-gate     unsigned int bi_version;
817c478bd9Sstevel@tonic-gate     unsigned char *bi_kernelname;
827c478bd9Sstevel@tonic-gate     struct nfs_diskless *bi_nfs_diskless;
837c478bd9Sstevel@tonic-gate     /* End of fields that are always present. */
847c478bd9Sstevel@tonic-gate #define bi_endcommon            bi_n_bios_used
857c478bd9Sstevel@tonic-gate     unsigned int bi_n_bios_used;
867c478bd9Sstevel@tonic-gate     unsigned long bi_bios_geom[N_BIOS_GEOM];
877c478bd9Sstevel@tonic-gate     unsigned int bi_size;
887c478bd9Sstevel@tonic-gate     unsigned char bi_memsizes_valid;
897c478bd9Sstevel@tonic-gate     unsigned char bi_bios_dev;
907c478bd9Sstevel@tonic-gate     unsigned char bi_pad[2];
917c478bd9Sstevel@tonic-gate     unsigned long bi_basemem;
927c478bd9Sstevel@tonic-gate     unsigned long bi_extmem;
937c478bd9Sstevel@tonic-gate     unsigned long bi_symtab;
947c478bd9Sstevel@tonic-gate     unsigned long bi_esymtab;
957c478bd9Sstevel@tonic-gate   };
96