Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/zfsboot/zfsboot.c
Show First 20 Lines • Show All 461 Lines • ▼ Show 20 Lines | load(void) | ||||
bootinfo.bi_esymtab = VTOP(p); | bootinfo.bi_esymtab = VTOP(p); | ||||
bootinfo.bi_kernelname = VTOP(kname); | bootinfo.bi_kernelname = VTOP(kname); | ||||
#ifdef LOADER_GELI_SUPPORT | #ifdef LOADER_GELI_SUPPORT | ||||
explicit_bzero(gelipw, sizeof(gelipw)); | explicit_bzero(gelipw, sizeof(gelipw)); | ||||
#endif | #endif | ||||
if (bdev->dd.d_dev->dv_type == DEVT_ZFS) { | if (bdev->dd.d_dev->dv_type == DEVT_ZFS) { | ||||
zfsargs.size = sizeof(zfsargs); | zfsargs.size = sizeof(zfsargs); | ||||
zfsargs.pool = bdev->d_kind.zfs.pool_guid; | zfsargs.pool = bdev->zfs.pool_guid; | ||||
zfsargs.root = bdev->d_kind.zfs.root_guid; | zfsargs.root = bdev->zfs.root_guid; | ||||
#ifdef LOADER_GELI_SUPPORT | #ifdef LOADER_GELI_SUPPORT | ||||
export_geli_boot_data(&zfsargs.gelidata); | export_geli_boot_data(&zfsargs.gelidata); | ||||
#endif | #endif | ||||
/* | /* | ||||
* Note that the zfsargs struct is passed by value, not by | * Note that the zfsargs struct is passed by value, not by | ||||
* pointer. Code in btxldr.S copies the values from the entry | * pointer. Code in btxldr.S copies the values from the entry | ||||
* stack to a fixed location within loader(8) at startup due | * stack to a fixed location within loader(8) at startup due | ||||
* to the presence of KARGS_FLAGS_EXTARG. | * to the presence of KARGS_FLAGS_EXTARG. | ||||
*/ | */ | ||||
__exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), | __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), | ||||
bootdev, | bootdev, | ||||
KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG, | KARGS_FLAGS_ZFS | KARGS_FLAGS_EXTARG, | ||||
(uint32_t)bdev->d_kind.zfs.pool_guid, | (uint32_t)bdev->zfs.pool_guid, | ||||
(uint32_t)(bdev->d_kind.zfs.pool_guid >> 32), | (uint32_t)(bdev->zfs.pool_guid >> 32), | ||||
VTOP(&bootinfo), | VTOP(&bootinfo), | ||||
zfsargs); | zfsargs); | ||||
} else { | } else { | ||||
#ifdef LOADER_GELI_SUPPORT | #ifdef LOADER_GELI_SUPPORT | ||||
geliargs.size = sizeof(geliargs); | geliargs.size = sizeof(geliargs); | ||||
export_geli_boot_data(&geliargs.gelidata); | export_geli_boot_data(&geliargs.gelidata); | ||||
#endif | #endif | ||||
Show All 29 Lines | if (i386_getdev((void **)&ddesc, root, NULL)) { | ||||
free(root); | free(root); | ||||
return (1); | return (1); | ||||
} | } | ||||
/* we should have new device descriptor, free old and replace it. */ | /* we should have new device descriptor, free old and replace it. */ | ||||
free(bdev); | free(bdev); | ||||
bdev = ddesc; | bdev = ddesc; | ||||
if (bdev->dd.d_dev->dv_type == DEVT_DISK) { | if (bdev->dd.d_dev->dv_type == DEVT_DISK) { | ||||
if (bdev->d_kind.biosdisk.partition == -1) | if (bdev->disk.d_partition == -1) | ||||
part = 0xff; | part = 0xff; | ||||
else | else | ||||
part = bdev->d_kind.biosdisk.partition; | part = bdev->disk.d_partition; | ||||
bootdev = MAKEBOOTDEV(dev_maj[bdev->dd.d_dev->dv_type], | bootdev = MAKEBOOTDEV(dev_maj[bdev->dd.d_dev->dv_type], | ||||
bdev->d_kind.biosdisk.slice + 1, | bdev->disk.d_slice + 1, bdev->dd.d_unit, part); | ||||
bdev->dd.d_unit, part); | |||||
bootinfo.bi_bios_dev = bd_unit2bios(bdev); | bootinfo.bi_bios_dev = bd_unit2bios(bdev); | ||||
} | } | ||||
strncpy(boot_devname, root, sizeof (boot_devname)); | strncpy(boot_devname, root, sizeof (boot_devname)); | ||||
setenv("currdev", root, 1); | setenv("currdev", root, 1); | ||||
free(root); | free(root); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | for (dev.dd.d_unit = 0; bd_unit2bios(&dev) >= 0; dev.dd.d_unit++) { | ||||
if (dev.dd.d_unit != boot_unit) | if (dev.dd.d_unit != boot_unit) | ||||
zfs_probe_dev(devname, NULL); | zfs_probe_dev(devname, NULL); | ||||
else | else | ||||
zfs_probe_dev(devname, &pool_guid); | zfs_probe_dev(devname, &pool_guid); | ||||
if (pool_guid != 0 && bdev == NULL) { | if (pool_guid != 0 && bdev == NULL) { | ||||
bdev = malloc(sizeof (struct i386_devdesc)); | bdev = malloc(sizeof (struct i386_devdesc)); | ||||
bzero(bdev, sizeof (struct i386_devdesc)); | bzero(bdev, sizeof (struct i386_devdesc)); | ||||
bdev->dd.d_dev = &zfs_dev; | bdev->zfs.dd.d_dev = &zfs_dev; | ||||
bdev->d_kind.zfs.pool_guid = pool_guid; | bdev->zfs.pool_guid = pool_guid; | ||||
} | } | ||||
} | } | ||||
} | } |