summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2008-03-12 16:01:34 +0000
committerraj <raj@FreeBSD.org>2008-03-12 16:01:34 +0000
commit7e7a99d55a83a8319b7b43dc69930dddc3698080 (patch)
tree51a866e675475040268a8ee7f99064e59ed6e48e /sys/boot/common
parent9efc2e038a05dfaeb46eb8a0737e4a3acbfe619e (diff)
downloadFreeBSD-src-7e7a99d55a83a8319b7b43dc69930dddc3698080.zip
FreeBSD-src-7e7a99d55a83a8319b7b43dc69930dddc3698080.tar.gz
Eliminate artificial increasing of 'netdev_opens' counter in loader's net_open().
This was introduced as a workaround long time ago for some Alpha firmware (which is now gone), and actually prevented net_close() to ever be called. Certain firmwares (U-Boot) need local shutdown operations to be performed on a network controller upon transaction end: such platform-specific hooks are supposed to be called via netif_close() (from within net_close()). This change effectively reverts the following CVS commit: sys/boot/common/dev_net.c revision 1.7 date: 2000/05/13 15:40:46; author: dfr; state: Exp; lines: +2 -1 Only probe network settings on the first open of the network device. The alpha firmware takes a seriously long time to open the network device the first time. Also suppress excessive output while netbooting via loader, unless debugging. While there, make sys/boot/uboot more style(9) compliant. Reviewed by: imp Approved by: cognet (mentor)
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/dev_net.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/boot/common/dev_net.c b/sys/boot/common/dev_net.c
index b7ccbca..eec53cc 100644
--- a/sys/boot/common/dev_net.c
+++ b/sys/boot/common/dev_net.c
@@ -144,7 +144,6 @@ net_open(struct open_file *f, ...)
return (error);
}
}
- netdev_opens++;
}
netdev_opens++;
f->f_devdata = &netdev_sock;
@@ -245,7 +244,8 @@ net_getparams(sock)
printf("net_open: bootparam/whoami RPC failed\n");
return (EIO);
}
- printf("net_open: client name: %s\n", hostname);
+ if (debug)
+ printf("net_open: client name: %s\n", hostname);
/*
* Ignore the gateway from whoami (unreliable).
@@ -259,10 +259,11 @@ net_getparams(sock)
}
if (smask) {
netmask = smask;
- printf("net_open: subnet mask: %s\n", intoa(netmask));
+ if (debug)
+ printf("net_open: subnet mask: %s\n", intoa(netmask));
}
- if (gateip.s_addr)
- printf("net_open: net gateway: %s\n", inet_ntoa(gateip));
+ if (gateip.s_addr && debug)
+ printf("net_open: net gateway: %s\n", inet_ntoa(gateip));
/* Get the root server and pathname. */
if (bp_getfile(sock, "root", &rootip, rootpath)) {
@@ -270,7 +271,7 @@ net_getparams(sock)
return (EIO);
}
exit:
- /*
+ /*
* If present, strip the server's address off of the rootpath
* before passing it along. This allows us to be compatible with
* the kernel's diskless (BOOTP_NFSROOT) booting conventions
@@ -285,8 +286,10 @@ net_getparams(sock)
bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
}
- printf("net_open: server addr: %s\n", inet_ntoa(rootip));
- printf("net_open: server path: %s\n", rootpath);
+ if (debug) {
+ printf("net_open: server addr: %s\n", inet_ntoa(rootip));
+ printf("net_open: server path: %s\n", rootpath);
+ }
d = socktodesc(sock);
sprintf(temp, "%6D", d->myea, ":");
OpenPOWER on IntegriCloud