summaryrefslogtreecommitdiff
path: root/usr/src/psm
diff options
context:
space:
mode:
authorJerry Gilliam <Jerry.Gilliam@Sun.COM>2009-03-13 11:39:23 -0700
committerJerry Gilliam <Jerry.Gilliam@Sun.COM>2009-03-13 11:39:23 -0700
commitc8551b44db1bafbbf984b3e5af9661804047e1cd (patch)
tree05c6a6811d79edbc6675233612eab853c8ebd041 /usr/src/psm
parent83cba5f6720ea576fe79a1cef0db4dc81718a7ff (diff)
downloadillumos-joyent-c8551b44db1bafbbf984b3e5af9661804047e1cd.tar.gz
6797441 wanboot fails to configure network device when booted from media
6813810 wanboot create ramdisk allocation fails on small memory machines
Diffstat (limited to 'usr/src/psm')
-rw-r--r--usr/src/psm/stand/boot/sparc/common/ramdisk.c6
-rw-r--r--usr/src/psm/stand/boot/sparc/common/wanboot.c76
2 files changed, 47 insertions, 35 deletions
diff --git a/usr/src/psm/stand/boot/sparc/common/ramdisk.c b/usr/src/psm/stand/boot/sparc/common/ramdisk.c
index ee0116f3d0..6f93d1cb9c 100644
--- a/usr/src/psm/stand/boot/sparc/common/ramdisk.c
+++ b/usr/src/psm/stand/boot/sparc/common/ramdisk.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/promif.h>
#include <sys/salib.h>
@@ -193,7 +191,7 @@ char ramdisk_bootable[] =
#define BOOT_ARCHIVE_ALLOC_SIZE (32 * 1024 * 1024) /* 32 MB */
#define BOOTFS_VIRT ((caddr_t)0x50f00000)
-#define ROOTFS_VIRT ((caddr_t)0x51000000)
+#define ROOTFS_VIRT ((caddr_t)0x52000000)
struct ramdisk_attr {
char *rd_name;
diff --git a/usr/src/psm/stand/boot/sparc/common/wanboot.c b/usr/src/psm/stand/boot/sparc/common/wanboot.c
index 0980d71b34..e642824583 100644
--- a/usr/src/psm/stand/boot/sparc/common/wanboot.c
+++ b/usr/src/psm/stand/boot/sparc/common/wanboot.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
/* EXPORT DELETE START */
#include <sys/promif.h>
@@ -1496,56 +1494,72 @@ init_netdev(char *bpath)
{
pnode_t anode;
int proplen;
- static char netalias[OBP_MAXPATHLEN];
+ char netalias[OBP_MAXPATHLEN];
+ static char devpath[OBP_MAXPATHLEN];
+ char *p;
+
+ bzero(netalias, sizeof (netalias));
+ bzero(devpath, sizeof (devpath));
/*
* Wanboot will either have loaded over the network (in which case
* bpath will name a network device), or from CD-ROM or disk. In
- * both cases ensure that the 'net' alias corresponds to a network
+ * either case ensure that the 'net' alias corresponds to a network
* device, and that if a network boot was performed that it is
* identical to bpath. This is so that the interface name can always
* be determined for CD-ROM or disk boots, and for manually-configured
* network boots. The latter restriction may be relaxed in the future.
*/
anode = prom_alias_node();
- if ((proplen = prom_getproplen(anode, "net")) > 0 &&
- proplen < sizeof (netalias)) {
- (void) prom_getprop(anode, "net", (caddr_t)netalias);
-
- if (is_netdev(netalias)) {
- char *p;
+ if ((proplen = prom_getproplen(anode, "net")) <= 0 ||
+ proplen > sizeof (netalias)) {
+ goto error;
+ }
+ (void) prom_getprop(anode, "net", (caddr_t)netalias);
- /*
- * Strip device arguments from netalias[].
- */
- if ((p = strchr(netalias, ':')) != NULL) {
- *p = '\0';
- }
+ /*
+ * Strip boot arguments from the net device to form
+ * the boot device path, returned as netdev_path.
+ */
+ if (strlcpy(devpath, netalias, sizeof (devpath)) >= sizeof (devpath))
+ goto error;
+ if ((p = strchr(devpath, ':')) != NULL) {
+ *p = '\0';
+ }
- /*
- * If bpath is a network device path, then v2path
- * will be a copy of this sans device arguments.
- */
- if (!is_netdev(bpath) ||
- strcmp(v2path, netalias) == 0) {
- /*
- * Stash the netdev_path bootprop value, then
- * initialize the hardware and return success.
- */
- netdev_path = netalias;
- mac_init(bpath);
- return (B_TRUE);
- }
+ if (!is_netdev(netalias)) {
+ bootlog("wanboot", BOOTLOG_CRIT, "'net'=%s\n", netalias);
+ goto error;
+ }
+ if (is_netdev(bpath)) {
+ /*
+ * If bpath is a network device path, then v2path
+ * will be a copy of this sans device arguments.
+ */
+ if (strcmp(v2path, devpath) != 0) {
+ bootlog("wanboot", BOOTLOG_CRIT,
+ "'net'=%s\n", netalias);
bootlog("wanboot", BOOTLOG_CRIT,
"wanboot requires that the 'net' alias refers to ");
bootlog("wanboot", BOOTLOG_CRIT,
"the network device path from which it loaded");
return (B_FALSE);
}
+ } else {
+ bpath = netalias;
}
/*
+ * Configure the network and return the network device.
+ */
+ bootlog("wanboot", BOOTLOG_INFO, "configuring %s\n", bpath);
+ netdev_path = devpath;
+ mac_init(bpath);
+ return (B_TRUE);
+
+error:
+ /*
* If we haven't established a device path for a network interface,
* then we're doomed.
*/