Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/stand/ofwboot Fix tftpboot which was broken b...



details:   https://anonhg.NetBSD.org/src/rev/dab1d50e1444
branches:  trunk
changeset: 780220:dab1d50e1444
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Jul 16 11:26:27 2012 +0000

description:
Fix tftpboot which was broken by my botched WARNSfy in last year.
Also add comments that mention libsa tftp requires network device socket
in f_devdata in struct open_file, from spz@ in PR port-sparc64/46652.
Briefly tested tftpboot and nfsboot on Ultra5.

diffstat:

 sys/arch/sparc/stand/ofwboot/net.c   |  18 ++++++++++++++++--
 sys/arch/sparc/stand/ofwboot/net.h   |   4 ++--
 sys/arch/sparc/stand/ofwboot/ofdev.c |   4 ++--
 3 files changed, 20 insertions(+), 6 deletions(-)

diffs (75 lines):

diff -r fb9e24c74a0a -r dab1d50e1444 sys/arch/sparc/stand/ofwboot/net.c
--- a/sys/arch/sparc/stand/ofwboot/net.c        Mon Jul 16 09:20:26 2012 +0000
+++ b/sys/arch/sparc/stand/ofwboot/net.c        Mon Jul 16 11:26:27 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net.c,v 1.7 2011/05/21 15:50:42 tsutsui Exp $  */
+/*     $NetBSD: net.c,v 1.8 2012/07/16 11:26:27 tsutsui Exp $  */
 
 /*
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -180,14 +180,28 @@
        return (0);
 }
 
+/*
+ * libsa's tftp_open expects a pointer to netdev_sock, i.e. an (int *),
+ * in f_devdata, a pointer to which gets handed down from devopen().
+ *
+ * Do not expect booting via different methods to have the same
+ * requirements or semantics.
+ *
+ * net_tftp_bootp uses net_mountroot_bootp because that incidentially does
+ * most of what it needs to do. It of course in no manner actually mounts
+ * anything, all that routine actually does is prepare the socket for the
+ * necessary net access, and print info for the user.
+ */
+
 int
-net_tftp_bootp(struct of_dev *op)
+net_tftp_bootp(int **sock)
 {
 
        net_mountroot_bootp();
        if (myip.s_addr == 0)
                return(ENOENT);
 
+       *sock = &netdev_sock;
        return (0);
 }
 
diff -r fb9e24c74a0a -r dab1d50e1444 sys/arch/sparc/stand/ofwboot/net.h
--- a/sys/arch/sparc/stand/ofwboot/net.h        Mon Jul 16 09:20:26 2012 +0000
+++ b/sys/arch/sparc/stand/ofwboot/net.h        Mon Jul 16 11:26:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: net.h,v 1.2 2011/05/21 15:50:42 tsutsui Exp $ */
+/* $NetBSD: net.h,v 1.3 2012/07/16 11:26:27 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 int    net_open(struct of_dev *);
 int    net_close(struct of_dev *);
-int    net_tftp_bootp(struct of_dev *);
+int    net_tftp_bootp(int **);
 int    net_mountroot(void);
 
 #endif /* _OFWBOOT_NET_H */
diff -r fb9e24c74a0a -r dab1d50e1444 sys/arch/sparc/stand/ofwboot/ofdev.c
--- a/sys/arch/sparc/stand/ofwboot/ofdev.c      Mon Jul 16 09:20:26 2012 +0000
+++ b/sys/arch/sparc/stand/ofwboot/ofdev.c      Mon Jul 16 11:26:27 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofdev.c,v 1.32 2011/06/01 11:42:18 tsutsui Exp $       */
+/*     $NetBSD: ofdev.c,v 1.33 2012/07/16 11:26:27 tsutsui Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -536,7 +536,7 @@
                if (!strncmp(*file,"/tftp:",6)) {
                        *file += 6;
                        memcpy(&file_system[0], &file_system_tftp, sizeof file_system[0]);
-                       if (net_tftp_bootp(of->f_devdata)) {
+                       if (net_tftp_bootp((int **)&of->f_devdata)) {
                                net_close(&ofdev);
                                goto bad;
                        }



Home | Main Index | Thread Index | Old Index