Module Name: src Committed By: riz Date: Sat Jul 21 00:04:56 UTC 2012
Modified Files: src/sys/arch/sparc/stand/ofwboot [netbsd-6]: net.c net.h ofdev.c Log Message: Pull up following revision(s) (requested by tsutsui in ticket #433): sys/arch/sparc/stand/ofwboot/net.h: revision 1.3 sys/arch/sparc/stand/ofwboot/net.c: revision 1.8 sys/arch/sparc/stand/ofwboot/ofdev.c: revision 1.33 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. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.10.1 src/sys/arch/sparc/stand/ofwboot/net.c cvs rdiff -u -r1.2 -r1.2.14.1 src/sys/arch/sparc/stand/ofwboot/net.h cvs rdiff -u -r1.32 -r1.32.10.1 src/sys/arch/sparc/stand/ofwboot/ofdev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/stand/ofwboot/net.c diff -u src/sys/arch/sparc/stand/ofwboot/net.c:1.7 src/sys/arch/sparc/stand/ofwboot/net.c:1.7.10.1 --- src/sys/arch/sparc/stand/ofwboot/net.c:1.7 Sat May 21 15:50:42 2011 +++ src/sys/arch/sparc/stand/ofwboot/net.c Sat Jul 21 00:04:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: net.c,v 1.7 2011/05/21 15:50:42 tsutsui Exp $ */ +/* $NetBSD: net.c,v 1.7.10.1 2012/07/21 00:04:56 riz Exp $ */ /* * Copyright (C) 1995 Wolfgang Solfrank. @@ -180,14 +180,28 @@ net_mountroot_bootp(void) 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); } Index: src/sys/arch/sparc/stand/ofwboot/net.h diff -u src/sys/arch/sparc/stand/ofwboot/net.h:1.2 src/sys/arch/sparc/stand/ofwboot/net.h:1.2.14.1 --- src/sys/arch/sparc/stand/ofwboot/net.h:1.2 Sat May 21 15:50:42 2011 +++ src/sys/arch/sparc/stand/ofwboot/net.h Sat Jul 21 00:04:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: net.h,v 1.2 2011/05/21 15:50:42 tsutsui Exp $ */ +/* $NetBSD: net.h,v 1.2.14.1 2012/07/21 00:04:56 riz 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 */ Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32.10.1 --- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.32 Wed Jun 1 11:42:18 2011 +++ src/sys/arch/sparc/stand/ofwboot/ofdev.c Sat Jul 21 00:04:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.32 2011/06/01 11:42:18 tsutsui Exp $ */ +/* $NetBSD: ofdev.c,v 1.32.10.1 2012/07/21 00:04:56 riz Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -536,7 +536,7 @@ open_again: 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; }