Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/zfsboot/zfsboot.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
#include "edd.h" | #include "edd.h" | ||||
#include "cons.h" | #include "cons.h" | ||||
#include "bootargs.h" | #include "bootargs.h" | ||||
#include "paths.h" | #include "paths.h" | ||||
#include "libzfs.h" | #include "libzfs.h" | ||||
#define ARGS 0x900 | #define ARGS 0x900 | ||||
#define NOPT 14 | #define NOPT 15 | ||||
#define NDEV 3 | #define NDEV 3 | ||||
#define BIOS_NUMDRIVES 0x475 | #define BIOS_NUMDRIVES 0x475 | ||||
#define DRV_HARD 0x80 | #define DRV_HARD 0x80 | ||||
#define DRV_MASK 0x7f | #define DRV_MASK 0x7f | ||||
#define TYPE_AD 0 | #define TYPE_AD 0 | ||||
#define TYPE_DA 1 | #define TYPE_DA 1 | ||||
#define TYPE_MAXHARD TYPE_DA | #define TYPE_MAXHARD TYPE_DA | ||||
#define TYPE_FD 2 | #define TYPE_FD 2 | ||||
#define DEV_GELIBOOT_BSIZE 4096 | #define DEV_GELIBOOT_BSIZE 4096 | ||||
extern uint32_t _end; | extern uint32_t _end; | ||||
#ifdef GPT | #ifdef GPT | ||||
static const uuid_t freebsd_zfs_uuid = GPT_ENT_TYPE_FREEBSD_ZFS; | static const uuid_t freebsd_zfs_uuid = GPT_ENT_TYPE_FREEBSD_ZFS; | ||||
#endif | #endif | ||||
static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ | static const char optstr[NOPT] = "DhaCcdgmnpqRrsv"; /* Also 'P', 'S' */ | ||||
static const unsigned char flags[NOPT] = { | static const unsigned char flags[NOPT] = { | ||||
RBX_DUAL, | RBX_DUAL, | ||||
RBX_SERIAL, | RBX_SERIAL, | ||||
RBX_ASKNAME, | RBX_ASKNAME, | ||||
RBX_CDROM, | RBX_CDROM, | ||||
RBX_CONFIG, | RBX_CONFIG, | ||||
RBX_KDB, | RBX_KDB, | ||||
RBX_GDB, | RBX_GDB, | ||||
RBX_MUTE, | RBX_MUTE, | ||||
RBX_NOINTR, | RBX_NOINTR, | ||||
RBX_PAUSE, | RBX_PAUSE, | ||||
RBX_QUIET, | RBX_QUIET, | ||||
RBX_RTERM, | |||||
RBX_DFLTROOT, | RBX_DFLTROOT, | ||||
RBX_SINGLE, | RBX_SINGLE, | ||||
RBX_VERBOSE | RBX_VERBOSE | ||||
}; | }; | ||||
uint32_t opts; | uint32_t opts; | ||||
/* | /* | ||||
* Paths to try loading before falling back to the boot2 prompt. | * Paths to try loading before falling back to the boot2 prompt. | ||||
Show All 15 Lines | |||||
static const unsigned char dev_maj[NDEV] = {30, 4, 2}; | static const unsigned char dev_maj[NDEV] = {30, 4, 2}; | ||||
static char cmd[512]; | static char cmd[512]; | ||||
static char cmddup[512]; | static char cmddup[512]; | ||||
static char kname[1024]; | static char kname[1024]; | ||||
static char rootname[256]; | static char rootname[256]; | ||||
static int comspeed = SIOSPD; | static int comspeed = SIOSPD; | ||||
static const char resettermcmd[] = SIORST; | |||||
static struct bootinfo bootinfo; | static struct bootinfo bootinfo; | ||||
static uint32_t bootdev; | static uint32_t bootdev; | ||||
static struct zfs_boot_args zfsargs; | static struct zfs_boot_args zfsargs; | ||||
vm_offset_t high_heap_base; | vm_offset_t high_heap_base; | ||||
uint32_t bios_basemem, bios_extmem, high_heap_size; | uint32_t bios_basemem, bios_extmem, high_heap_size; | ||||
static struct bios_smap smap; | static struct bios_smap smap; | ||||
▲ Show 20 Lines • Show All 1,001 Lines • ▼ Show 20 Lines | if (c == '-') { | ||||
for (i = 0; c != optstr[i]; i++) | for (i = 0; c != optstr[i]; i++) | ||||
if (i == NOPT - 1) | if (i == NOPT - 1) | ||||
return -1; | return -1; | ||||
opts ^= OPT_SET(flags[i]); | opts ^= OPT_SET(flags[i]); | ||||
} | } | ||||
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : | ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : | ||||
OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; | OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; | ||||
if (ioctrl & IO_SERIAL) { | if (ioctrl & IO_SERIAL) { | ||||
if (sio_init(115200 / comspeed) != 0) | if (sio_init(115200 / comspeed) != 0) { | ||||
ioctrl &= ~IO_SERIAL; | ioctrl &= ~IO_SERIAL; | ||||
} else if (OPT_CHECK(RBX_RTERM)) { | |||||
for (i = 0; resettermcmd[i]; i++) | |||||
sio_putc(resettermcmd[i]); | |||||
sio_flush(); | |||||
} | |||||
freqlabs: The white space in this block breaks the convention of the rest of this file. | |||||
} | } | ||||
} if (c == '?') { | } if (c == '?') { | ||||
dnode_phys_t dn; | dnode_phys_t dn; | ||||
if (zfs_lookup(&zfsmount, arg, &dn) == 0) { | if (zfs_lookup(&zfsmount, arg, &dn) == 0) { | ||||
zap_list(spa, &dn); | zap_list(spa, &dn); | ||||
} | } | ||||
return -1; | return -1; | ||||
Show All 38 Lines |
The white space in this block breaks the convention of the rest of this file.