4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/param.h>
27 #include <sys/fcntl.h>
28 #include <sys/obpdefs.h>
29 #include <sys/reboot.h>
30 #include <sys/promif.h>
31 #include <sys/stat.h>
32 #include <sys/bootvfs.h>
33 #include <sys/platnames.h>
34 #include <sys/salib.h>
35 #include <sys/elf.h>
36 #include <sys/link.h>
37 #include <sys/auxv.h>
38 #include <sys/boot_policy.h>
39 #include <sys/boot_redirect.h>
40 #include <sys/bootconf.h>
41 #include <sys/boot.h>
42 #include "boot_plat.h"
43
436 }
437
438 /*
439 * Handle fully qualified OpenBoot pathname.
440 */
441 while (--p >= bpath && *p != '@' && *p != '/')
442 if (*p == ':')
443 break;
444 if (*p++ == ':') {
445 /*
446 * Convert slice number to partition 'letter'.
447 */
448 *p++ = 'a' + slicec - '0';
449 *p = '\0';
450 v2path = bpath;
451 return;
452 }
453 prom_panic("redirect_boot_path: mangled boot path!");
454 }
455
456 #define PROM_VERS_MAX_LEN 64
457
458 void
459 system_check(void)
460 {
461 char buf[PROM_VERS_MAX_LEN];
462 pnode_t n;
463 char arch[128];
464 size_t len;
465 bootplat_defaults_t *plat_defaults;
466
467 /*
468 * This is a sun4v machine iff the device_type property
469 * exists on the root node and has the value "sun4v".
470 * Some older sunfire proms do not have such a property.
471 */
472 is_sun4v = 0;
473 n = prom_rootnode();
474 len = prom_getproplen(n, "device_type");
475 if (len > 0 && len < sizeof (arch)) {
476 (void) prom_getprop(n, "device_type", arch);
477 arch[len] = '\0';
478 dprintf("device_type=%s\n", arch);
479 if (strcmp(arch, "sun4v") == 0) {
480 is_sun4v = 1;
481 }
482 } else {
483 dprintf("device_type: no such property, len=%d\n", (int)len);
484 }
485
486 if (!is_sun4v && cpu_is_ultrasparc_1()) {
487 printf("UltraSPARC I processors are not supported by this "
488 "release of Solaris.\n");
489 prom_exit_to_mon();
490 }
491
492 /*
493 * Set up defaults per platform
494 */
495 plat_defaults = (is_sun4v) ?
496 &sun4v_plat_defaults : &sun4u_plat_defaults;
497
498 default_name = plat_defaults->plat_defaults_name;
499 default_path = plat_defaults->plat_defaults_path;
500 vac = plat_defaults->plat_defaults_vac;
501
502 dprintf("default_name: %s\n", default_name);
503 dprintf("default_path: %s\n", default_path);
504 dprintf("vac: %d\n", vac);
505
506 if (prom_version_check(buf, PROM_VERS_MAX_LEN, NULL) != PROM_VER64_OK) {
507 printf("The firmware on this system does not support the 64-bit"
508 " OS.\n\tPlease upgrade to at least the following version:"
509 "\n\n\t%s\n", buf);
510 prom_exit_to_mon();
511 }
512 }
513
514 /*
515 * Reads in the standalone (client) program and jumps to it. If this
516 * attempt fails, prints "boot failed" and returns to its caller.
517 *
518 * It will try to determine if it is loading a Unix file by
519 * looking at what should be the magic number. If it makes
520 * sense, it will use it; otherwise it jumps to the first
521 * address of the blocks that it reads in.
522 *
523 * This new boot program will open a file, read the ELF header,
524 * attempt to allocate and map memory at the location at which
525 * the client desires to be linked, and load the program at
526 * that point. It will then jump there.
527 */
528 /*ARGSUSED*/
529 int
530 main(void *cookie, char **argv, int argc)
531 {
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2019 Peter Tribbble.
25 */
26
27 #include <sys/param.h>
28 #include <sys/fcntl.h>
29 #include <sys/obpdefs.h>
30 #include <sys/reboot.h>
31 #include <sys/promif.h>
32 #include <sys/stat.h>
33 #include <sys/bootvfs.h>
34 #include <sys/platnames.h>
35 #include <sys/salib.h>
36 #include <sys/elf.h>
37 #include <sys/link.h>
38 #include <sys/auxv.h>
39 #include <sys/boot_policy.h>
40 #include <sys/boot_redirect.h>
41 #include <sys/bootconf.h>
42 #include <sys/boot.h>
43 #include "boot_plat.h"
44
437 }
438
439 /*
440 * Handle fully qualified OpenBoot pathname.
441 */
442 while (--p >= bpath && *p != '@' && *p != '/')
443 if (*p == ':')
444 break;
445 if (*p++ == ':') {
446 /*
447 * Convert slice number to partition 'letter'.
448 */
449 *p++ = 'a' + slicec - '0';
450 *p = '\0';
451 v2path = bpath;
452 return;
453 }
454 prom_panic("redirect_boot_path: mangled boot path!");
455 }
456
457 void
458 system_check(void)
459 {
460 pnode_t n;
461 char arch[128];
462 size_t len;
463 bootplat_defaults_t *plat_defaults;
464
465 /*
466 * This is a sun4v machine iff the device_type property
467 * exists on the root node and has the value "sun4v".
468 * Some older sunfire proms do not have such a property.
469 */
470 is_sun4v = 0;
471 n = prom_rootnode();
472 len = prom_getproplen(n, "device_type");
473 if (len > 0 && len < sizeof (arch)) {
474 (void) prom_getprop(n, "device_type", arch);
475 arch[len] = '\0';
476 dprintf("device_type=%s\n", arch);
477 if (strcmp(arch, "sun4v") == 0) {
478 is_sun4v = 1;
479 }
480 } else {
481 dprintf("device_type: no such property, len=%d\n", (int)len);
482 }
483
484 /*
485 * Set up defaults per platform
486 */
487 plat_defaults = (is_sun4v) ?
488 &sun4v_plat_defaults : &sun4u_plat_defaults;
489
490 default_name = plat_defaults->plat_defaults_name;
491 default_path = plat_defaults->plat_defaults_path;
492 vac = plat_defaults->plat_defaults_vac;
493
494 dprintf("default_name: %s\n", default_name);
495 dprintf("default_path: %s\n", default_path);
496 dprintf("vac: %d\n", vac);
497 }
498
499 /*
500 * Reads in the standalone (client) program and jumps to it. If this
501 * attempt fails, prints "boot failed" and returns to its caller.
502 *
503 * It will try to determine if it is loading a Unix file by
504 * looking at what should be the magic number. If it makes
505 * sense, it will use it; otherwise it jumps to the first
506 * address of the blocks that it reads in.
507 *
508 * This new boot program will open a file, read the ELF header,
509 * attempt to allocate and map memory at the location at which
510 * the client desires to be linked, and load the program at
511 * that point. It will then jump there.
512 */
513 /*ARGSUSED*/
514 int
515 main(void *cookie, char **argv, int argc)
516 {
|