Fri Nov 2 17:47:30 2012 UTC ()
In register_device(), skip indirectly attached iic children (ia_name is NULL).


(jdc)
diff -r1.190 -r1.191 src/sys/arch/sparc64/sparc64/autoconf.c

cvs diff -r1.190 -r1.191 src/sys/arch/sparc64/sparc64/autoconf.c (expand / switch to unified diff)

--- src/sys/arch/sparc64/sparc64/autoconf.c 2012/10/27 17:18:12 1.190
+++ src/sys/arch/sparc64/sparc64/autoconf.c 2012/11/02 17:47:29 1.191
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: autoconf.c,v 1.190 2012/10/27 17:18:12 chs Exp $ */ 1/* $NetBSD: autoconf.c,v 1.191 2012/11/02 17:47:29 jdc Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * The President and Fellows of Harvard College. All rights reserved. 5 * The President and Fellows of Harvard College. All rights reserved.
6 * Copyright (c) 1992, 1993 6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * This software was developed by the Computer Systems Engineering group 9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
11 * contributed to Berkeley. 11 * contributed to Berkeley.
12 * 12 *
13 * All advertising materials mentioning features or use of this software 13 * All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement: 14 * must display the following acknowledgement:
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE. 45 * SUCH DAMAGE.
46 * 46 *
47 * @(#)autoconf.c 8.4 (Berkeley) 10/1/93 47 * @(#)autoconf.c 8.4 (Berkeley) 10/1/93
48 */ 48 */
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.190 2012/10/27 17:18:12 chs Exp $"); 51__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.191 2012/11/02 17:47:29 jdc Exp $");
52 52
53#include "opt_ddb.h" 53#include "opt_ddb.h"
54#include "opt_kgdb.h" 54#include "opt_kgdb.h"
55#include "opt_modular.h" 55#include "opt_modular.h"
56#include "opt_multiprocessor.h" 56#include "opt_multiprocessor.h"
57 57
58#include <sys/param.h> 58#include <sys/param.h>
59#include <sys/kernel.h> 59#include <sys/kernel.h>
60#include <sys/systm.h> 60#include <sys/systm.h>
61#include <sys/buf.h> 61#include <sys/buf.h>
62#include <sys/disklabel.h> 62#include <sys/disklabel.h>
63#include <sys/device.h> 63#include <sys/device.h>
64#include <sys/disk.h> 64#include <sys/disk.h>
@@ -903,26 +903,29 @@ device_register(device_t dev, void *aux) @@ -903,26 +903,29 @@ device_register(device_t dev, void *aux)
903 ofnode = PCITAG_NODE(pa->pa_tag); 903 ofnode = PCITAG_NODE(pa->pa_tag);
904 } else if (device_is_a(busdev, "sbus") || device_is_a(busdev, "dma") 904 } else if (device_is_a(busdev, "sbus") || device_is_a(busdev, "dma")
905 || device_is_a(busdev, "ledma")) { 905 || device_is_a(busdev, "ledma")) {
906 struct sbus_attach_args *sa = aux; 906 struct sbus_attach_args *sa = aux;
907 907
908 ofnode = sa->sa_node; 908 ofnode = sa->sa_node;
909 } else if (device_is_a(busdev, "ebus")) { 909 } else if (device_is_a(busdev, "ebus")) {
910 struct ebus_attach_args *ea = aux; 910 struct ebus_attach_args *ea = aux;
911 911
912 ofnode = ea->ea_node; 912 ofnode = ea->ea_node;
913 } else if (device_is_a(busdev, "iic")) { 913 } else if (device_is_a(busdev, "iic")) {
914 struct i2c_attach_args *ia = aux; 914 struct i2c_attach_args *ia = aux;
915 915
 916 if (ia->ia_name == NULL) /* indirect config */
 917 return;
 918
916 ofnode = (int)ia->ia_cookie; 919 ofnode = (int)ia->ia_cookie;
917 } else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) { 920 } else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) {
918 struct scsipibus_attach_args *sa = aux; 921 struct scsipibus_attach_args *sa = aux;
919 struct scsipi_periph *periph = sa->sa_periph; 922 struct scsipi_periph *periph = sa->sa_periph;
920 int off = 0; 923 int off = 0;
921 924
922 /* 925 /*
923 * There are two "cd" attachments: 926 * There are two "cd" attachments:
924 * atapibus -> atabus -> controller 927 * atapibus -> atabus -> controller
925 * scsibus -> controller 928 * scsibus -> controller
926 * We want the node of the controller. 929 * We want the node of the controller.
927 */ 930 */
928 if (device_is_a(busdev, "atapibus")) { 931 if (device_is_a(busdev, "atapibus")) {