From owner-svn-src-all@freebsd.org Tue May 10 04:55:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EB19B35C67; Tue, 10 May 2016 04:55:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9A801E4C; Tue, 10 May 2016 04:55:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4A4tw5q074216; Tue, 10 May 2016 04:55:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4A4tvqc074214; Tue, 10 May 2016 04:55:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605100455.u4A4tvqc074214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 10 May 2016 04:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299314 - head/sys/dev/bhnd/bcma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Tue, 10 May 2016 04:55:59 -0000 Author: adrian Date: Tue May 10 04:55:57 2016 New Revision: 299314 URL: https://svnweb.freebsd.org/changeset/base/299314 Log: [bhnd] fix bcma resource allocation for regions; EROM work around. * bcma.c - assign different resource IDs for different regions * bcma_erom.c - workaround for BCM/MIPS bus enumerations Tested: * (submitter) Tested on ASUS RT-N16 initially, double checked on ASUS RT-N53 * (landonf) BCM4331 Submitted by: Michael Zhilin Differential Revision: https://reviews.freebsd.org/D6245 Modified: head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcma_erom.c Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Tue May 10 04:01:04 2016 (r299313) +++ head/sys/dev/bhnd/bcma/bcma.c Tue May 10 04:55:57 2016 (r299314) @@ -97,7 +97,7 @@ bcma_attach(device_t dev) r_count = size; r_end = r_start + r_count - 1; - dinfo->rid_agent = 0; + dinfo->rid_agent = i + 1; dinfo->res_agent = bhnd_alloc_resource(dev, SYS_RES_MEMORY, &dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE); if (dinfo->res_agent == NULL) { Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Tue May 10 04:01:04 2016 (r299313) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Tue May 10 04:55:57 2016 (r299314) @@ -878,7 +878,26 @@ bcma_erom_parse_corecfg(struct bcma_erom for (uint8_t i = 0; i < core.num_swrap; i++) { /* Slave wrapper ports are not numbered distinctly from master * wrapper ports. */ - uint8_t sp_num = core.num_mwrap + i; + + /* + * Broadcom DDR1/DDR2 Memory Controller + * (cid=82e, rev=1, unit=0, d/mw/sw = 2/0/1 ) -> + * bhnd0: erom[0xdc]: core6 agent0.0: mismatch got: 0x1 (0x2) + * + * ARM BP135 AMBA3 AXI to APB Bridge + * (cid=135, rev=0, unit=0, d/mw/sw = 1/0/1 ) -> + * bhnd0: erom[0x124]: core9 agent1.0: mismatch got: 0x0 (0x2) + * + * core.num_mwrap + * ===> + * (core.num_mwrap > 0) ? + * core.num_mwrap : + * ((core.vendor == BHND_MFGID_BCM) ? 1 : 0) + */ + uint8_t sp_num; + sp_num = (core.num_mwrap > 0) ? + core.num_mwrap : + ((core.vendor == BHND_MFGID_BCM) ? 1 : 0) + i; error = erom_corecfg_fill_port_regions(erom, cfg, sp_num, BCMA_EROM_REGION_TYPE_SWRAP);