From owner-svn-src-projects@FreeBSD.ORG Tue Apr 5 01:51:30 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD0A1065670; Tue, 5 Apr 2011 01:51:30 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 714638FC08; Tue, 5 Apr 2011 01:51:30 +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 p351pUlU001816; Tue, 5 Apr 2011 01:51:30 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p351pUEN001814; Tue, 5 Apr 2011 01:51:30 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201104050151.p351pUEN001814@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 5 Apr 2011 01:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220349 - projects/altix/sys/ia64/sgisn X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 01:51:30 -0000 Author: marcel Date: Tue Apr 5 01:51:30 2011 New Revision: 220349 URL: http://svn.freebsd.org/changeset/base/220349 Log: When enumerating the busses (in all domains) on the BSP, the firmware returns all of busses in the system, not just the busses local to the BSP. We use the base address of the bus to extract the NASID and use that to match busses against shubs. Consequently, the logical device hierarchy is the same as the physical interconnect. Modified: projects/altix/sys/ia64/sgisn/sgisn_shub.c Modified: projects/altix/sys/ia64/sgisn/sgisn_shub.c ============================================================================== --- projects/altix/sys/ia64/sgisn/sgisn_shub.c Tue Apr 5 01:42:06 2011 (r220348) +++ projects/altix/sys/ia64/sgisn/sgisn_shub.c Tue Apr 5 01:51:30 2011 (r220349) @@ -348,6 +348,7 @@ sgisn_shub_attach(device_t dev) { struct ia64_sal_result r; struct sgisn_shub_softc *sc; + struct sgisn_fwbus *fwbus; ACPI_TABLE_HEADER *tbl; device_t child; void *ptr; @@ -410,33 +411,21 @@ sgisn_shub_attach(device_t dev) for (wdgt = 0; wdgt < SGISN_HUB_NWIDGETS; wdgt++) sc->sc_fwhub->hub_widget[wdgt].wgt_hub = sc->sc_fwhub; - r = ia64_sal_entry(SAL_SGISN_KLCONFIG_ADDR, sc->sc_nasid, - 0, 0, 0, 0, 0, 0); - device_printf(dev, "KLCONFIG: status=%#lx, addr=%#lx\n", - r.sal_status, r.sal_result[0]); - - /* - * XXX Hack to avoid having the same PCI busses as children of any - * SHub we have. The problem is that we can't pass the nasid to the - * the SAL function. So either we get all the busses, irrespective - * of the node in which they live or we always get the busses local - * to the CPU. I can't tell the difference, because I don't have - * busses on the other brick right now. - * In any case: we don't have a good way yet to figure out if the - * bus connects to the SHub in question. - */ - if (sc->sc_nasid != 0) - return (0); - for (seg = 0; seg <= sc->sc_fwhub->hub_pci_maxseg; seg++) { for (bus = 0; bus <= sc->sc_fwhub->hub_pci_maxbus; bus++) { r = ia64_sal_entry(SAL_SGISN_IOBUS_INFO, seg, bus, ia64_tpa((uintptr_t)&addr), 0, 0, 0, 0); - if (r.sal_status == 0 && addr != 0) { - child = device_add_child(dev, "pcib", -1); - device_set_ivars(child, (void *)(uintptr_t) - ((seg << 8) | (bus & 0xff))); - } + if (r.sal_status != 0 || addr == 0) + continue; + + fwbus = (void *)IA64_PHYS_TO_RR7(addr); + if (((fwbus->bus_base >> sc->sc_nasid_shft) & + sc->sc_nasid_mask) != sc->sc_nasid) + continue; + + child = device_add_child(dev, "pcib", -1); + device_set_ivars(child, + (void *)(uintptr_t) ((seg << 8) | (bus & 0xff))); } }