main.c (4784aef9f55a4c8284ee951bb30b70f9ba8b7698) | main.c (de04d704a98a7d2e9e57ebd83d2dd7a19fc11dab) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 240 unchanged lines hidden (view full) --- 249{ 250 struct i386_devdesc new_currdev; 251#ifdef LOADER_ZFS_SUPPORT 252 char buf[20]; 253#endif 254 int biosdev = -1; 255 256 /* Assume we are booting from a BIOS disk by default */ | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 240 unchanged lines hidden (view full) --- 249{ 250 struct i386_devdesc new_currdev; 251#ifdef LOADER_ZFS_SUPPORT 252 char buf[20]; 253#endif 254 int biosdev = -1; 255 256 /* Assume we are booting from a BIOS disk by default */ |
257 new_currdev.d_dev = &biosdisk; | 257 new_currdev.dd.d_dev = &biosdisk; |
258 259 /* new-style boot loaders such as pxeldr and cdldr */ 260 if (kargs->bootinfo == 0) { 261 if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { 262 /* we are booting from a CD with cdboot */ | 258 259 /* new-style boot loaders such as pxeldr and cdldr */ 260 if (kargs->bootinfo == 0) { 261 if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { 262 /* we are booting from a CD with cdboot */ |
263 new_currdev.d_dev = &bioscd; 264 new_currdev.d_unit = bc_bios2unit(initial_bootdev); | 263 new_currdev.dd.d_dev = &bioscd; 264 new_currdev.dd.d_unit = bc_bios2unit(initial_bootdev); |
265 } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { 266 /* we are booting from pxeldr */ | 265 } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { 266 /* we are booting from pxeldr */ |
267 new_currdev.d_dev = &pxedisk; 268 new_currdev.d_unit = 0; | 267 new_currdev.dd.d_dev = &pxedisk; 268 new_currdev.dd.d_unit = 0; |
269 } else { 270 /* we don't know what our boot device is */ 271 new_currdev.d_kind.biosdisk.slice = -1; 272 new_currdev.d_kind.biosdisk.partition = 0; 273 biosdev = -1; 274 } 275#ifdef LOADER_ZFS_SUPPORT 276 } else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { --- 13 unchanged lines hidden (view full) --- 290 sprintf(buf, "%llu", zargs->primary_vdev); 291 setenv("vfs.zfs.boot.primary_vdev", buf, 1); 292 } 293 } else { 294 /* old style zfsboot block */ 295 new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; 296 new_currdev.d_kind.zfs.root_guid = 0; 297 } | 269 } else { 270 /* we don't know what our boot device is */ 271 new_currdev.d_kind.biosdisk.slice = -1; 272 new_currdev.d_kind.biosdisk.partition = 0; 273 biosdev = -1; 274 } 275#ifdef LOADER_ZFS_SUPPORT 276 } else if ((kargs->bootflags & KARGS_FLAGS_ZFS) != 0) { --- 13 unchanged lines hidden (view full) --- 290 sprintf(buf, "%llu", zargs->primary_vdev); 291 setenv("vfs.zfs.boot.primary_vdev", buf, 1); 292 } 293 } else { 294 /* old style zfsboot block */ 295 new_currdev.d_kind.zfs.pool_guid = kargs->zfspool; 296 new_currdev.d_kind.zfs.root_guid = 0; 297 } |
298 new_currdev.d_dev = &zfs_dev; | 298 new_currdev.dd.d_dev = &zfs_dev; |
299#endif 300 } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { 301 /* The passed-in boot device is bad */ 302 new_currdev.d_kind.biosdisk.slice = -1; 303 new_currdev.d_kind.biosdisk.partition = 0; 304 biosdev = -1; 305 } else { 306 new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1; --- 4 unchanged lines hidden (view full) --- 311 * If we are booted by an old bootstrap, we have to guess at the BIOS 312 * unit number. We will lose if there is more than one disk type 313 * and we are not booting from the lowest-numbered disk type 314 * (ie. SCSI when IDE also exists). 315 */ 316 if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */ 317 biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */ 318 } | 299#endif 300 } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { 301 /* The passed-in boot device is bad */ 302 new_currdev.d_kind.biosdisk.slice = -1; 303 new_currdev.d_kind.biosdisk.partition = 0; 304 biosdev = -1; 305 } else { 306 new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1; --- 4 unchanged lines hidden (view full) --- 311 * If we are booted by an old bootstrap, we have to guess at the BIOS 312 * unit number. We will lose if there is more than one disk type 313 * and we are not booting from the lowest-numbered disk type 314 * (ie. SCSI when IDE also exists). 315 */ 316 if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) /* biosdev doesn't match major */ 317 biosdev = 0x80 + B_UNIT(initial_bootdev); /* assume harddisk */ 318 } |
319 new_currdev.d_type = new_currdev.d_dev->dv_type; | 319 new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type; |
320 321 /* 322 * If we are booting off of a BIOS disk and we didn't succeed in determining 323 * which one we booted off of, just use disk0: as a reasonable default. 324 */ | 320 321 /* 322 * If we are booting off of a BIOS disk and we didn't succeed in determining 323 * which one we booted off of, just use disk0: as a reasonable default. 324 */ |
325 if ((new_currdev.d_type == biosdisk.dv_type) && 326 ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) { | 325 if ((new_currdev.dd.d_type == biosdisk.dv_type) && 326 ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) { |
327 printf("Can't work out which disk we are booting from.\n" 328 "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); | 327 printf("Can't work out which disk we are booting from.\n" 328 "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); |
329 new_currdev.d_unit = 0; | 329 new_currdev.dd.d_unit = 0; |
330 } 331 332#ifdef LOADER_ZFS_SUPPORT | 330 } 331 332#ifdef LOADER_ZFS_SUPPORT |
333 if (new_currdev.d_type == DEVT_ZFS) | 333 if (new_currdev.dd.d_type == DEVT_ZFS) |
334 init_zfs_bootenv(zfs_fmtdev(&new_currdev)); 335#endif 336 337 env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), 338 i386_setcurrdev, env_nounset); 339 env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, 340 env_nounset); 341} --- 69 unchanged lines hidden --- | 334 init_zfs_bootenv(zfs_fmtdev(&new_currdev)); 335#endif 336 337 env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), 338 i386_setcurrdev, env_nounset); 339 env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, 340 env_nounset); 341} --- 69 unchanged lines hidden --- |