Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2016 04:55:57 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299314 - head/sys/dev/bhnd/bcma
Message-ID:  <201605100455.u4A4tvqc074214@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <mizkha@gmail.com>
  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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605100455.u4A4tvqc074214>