From owner-svn-src-all@FreeBSD.ORG Sat Feb 13 18:51:50 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F0B41065693; Sat, 13 Feb 2010 18:51:49 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F3F58FC1E; Sat, 13 Feb 2010 18:51:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1DIpnCM019677; Sat, 13 Feb 2010 18:51:49 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1DIpngt019671; Sat, 13 Feb 2010 18:51:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201002131851.o1DIpngt019671@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Feb 2010 18:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203844 - in head/sys/sparc64: include sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Feb 2010 18:51:50 -0000 Author: marius Date: Sat Feb 13 18:51:49 2010 New Revision: 203844 URL: http://svn.freebsd.org/changeset/base/203844 Log: - Add the 'cmp' and 'core' pseudo-busses which are used to group CPU cores to the exclusion lists as the CPU nodes aren't handled as regular devices either. Also add the pseudo-devices found in Sun Fire V1280. - Allow nexus_attach() and nexus_alloc_resource() to be used by drivers derived from nexus(4) for subordinate busses. - Don't add the zero-sized memory resources of glue devices to the resource lists. Modified: head/sys/sparc64/include/nexusvar.h head/sys/sparc64/sparc64/nexus.c Modified: head/sys/sparc64/include/nexusvar.h ============================================================================== --- head/sys/sparc64/include/nexusvar.h Sat Feb 13 18:18:45 2010 (r203843) +++ head/sys/sparc64/include/nexusvar.h Sat Feb 13 18:51:49 2010 (r203844) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2001 by Thomas Moestl . + * Copyright (c) 2010 Marius Strobl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11,48 +11,24 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _MACHINE_NEXUSVAR_H_ -#define _MACHINE_NEXUSVAR_H_ +#define _MACHINE_NEXUSVAR_H_ -enum nexus_ivars { - NEXUS_IVAR_NODE, - NEXUS_IVAR_NAME, - NEXUS_IVAR_DEVICE_TYPE, - NEXUS_IVAR_MODEL, - NEXUS_IVAR_REG, - NEXUS_IVAR_NREG, - NEXUS_IVAR_INTERRUPTS, - NEXUS_IVAR_NINTERRUPTS, - NEXUS_IVAR_DMATAG, -}; - -#define NEXUS_ACCESSOR(var, ivar, type) \ - __BUS_ACCESSOR(nexus, var, NEXUS, ivar, type) - -NEXUS_ACCESSOR(node, NODE, phandle_t) -NEXUS_ACCESSOR(name, NAME, char *) -NEXUS_ACCESSOR(device_type, DEVICE_TYPE, char *) -NEXUS_ACCESSOR(model, MODEL, char *) -NEXUS_ACCESSOR(reg, REG, struct upa_regs *) -NEXUS_ACCESSOR(nreg, NREG, int) -NEXUS_ACCESSOR(interrupts, INTERRUPTS, u_int *) -NEXUS_ACCESSOR(ninterrupts, NINTERRUPTS, int) -NEXUS_ACCESSOR(dmatag, DMATAG, bus_dma_tag_t) - -#undef NEXUS_ACCESSOR +DECLARE_CLASS(nexus_driver); #endif /* _MACHINE_NEXUSVAR_H_ */ Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Sat Feb 13 18:18:45 2010 (r203843) +++ head/sys/sparc64/sparc64/nexus.c Sat Feb 13 18:51:49 2010 (r203844) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -154,17 +155,22 @@ static const char *const nexus_excl_name "aliases", "associations", "chosen", + "cmp", "counter-timer", /* No separate device; handled by psycho/sbus */ + "failsafe", "memory", "openprom", "options", "packages", "rsc", + "sgcn", + "todsg", "virtual-memory", NULL }; static const char *const nexus_excl_type[] = { + "core", "cpu", NULL }; @@ -206,20 +212,24 @@ nexus_attach(device_t dev) device_t cdev; phandle_t node; - node = OF_peer(0); - if (node == -1) - panic("%s: OF_peer failed.", __func__); - - sc = device_get_softc(dev); - sc->sc_intr_rman.rm_type = RMAN_ARRAY; - sc->sc_intr_rman.rm_descr = "Interrupts"; - sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "Device Memory"; - if (rman_init(&sc->sc_intr_rman) != 0 || - rman_init(&sc->sc_mem_rman) != 0 || - rman_manage_region(&sc->sc_intr_rman, 0, IV_MAX - 1) != 0 || - rman_manage_region(&sc->sc_mem_rman, 0ULL, ~0ULL) != 0) - panic("%s: failed to set up rmans.", __func__); + if (strcmp(device_get_name(device_get_parent(dev)), "root") == 0) { + node = OF_peer(0); + if (node == -1) + panic("%s: OF_peer failed.", __func__); + + sc = device_get_softc(dev); + sc->sc_intr_rman.rm_type = RMAN_ARRAY; + sc->sc_intr_rman.rm_descr = "Interrupts"; + sc->sc_mem_rman.rm_type = RMAN_ARRAY; + sc->sc_mem_rman.rm_descr = "Device Memory"; + if (rman_init(&sc->sc_intr_rman) != 0 || + rman_init(&sc->sc_mem_rman) != 0 || + rman_manage_region(&sc->sc_intr_rman, 0, + IV_MAX - 1) != 0 || + rman_manage_region(&sc->sc_mem_rman, 0ULL, ~0ULL) != 0) + panic("%s: failed to set up rmans.", __func__); + } else + node = ofw_bus_get_node(dev); /* * Allow devices to identify. @@ -347,12 +357,16 @@ nexus_alloc_resource(device_t bus, devic struct rman *rm; struct resource *rv; struct resource_list_entry *rle; + device_t nexus; int isdefault, needactivate, passthrough; isdefault = (start == 0UL && end == ~0UL); needactivate = flags & RF_ACTIVE; passthrough = (device_get_parent(child) != bus); - sc = device_get_softc(bus); + nexus = bus; + while (strcmp(device_get_name(device_get_parent(nexus)), "root") != 0) + nexus = device_get_parent(nexus); + sc = device_get_softc(nexus); rle = NULL; if (!passthrough) { @@ -498,8 +512,10 @@ nexus_setup_dinfo(device_t dev, phandle_ for (i = 0; i < nreg; i++) { phys = NEXUS_REG_PHYS(®[i]); size = NEXUS_REG_SIZE(®[i]); - resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i, phys, - phys + size - 1, size); + /* Skip the dummy reg property of glue devices like ssm(4). */ + if (size != 0) + resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i, + phys, phys + size - 1, size); } free(reg, M_OFWPROP);