[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
This commit is contained in:
Adrian Chadd 2016-05-10 04:55:57 +00:00
parent 1f1bf434c6
commit 05992f9e2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299314
2 changed files with 21 additions and 2 deletions

View File

@ -97,7 +97,7 @@ bcma_attach(device_t dev)
r_count = size; r_count = size;
r_end = r_start + r_count - 1; 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->res_agent = bhnd_alloc_resource(dev, SYS_RES_MEMORY,
&dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE); &dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE);
if (dinfo->res_agent == NULL) { if (dinfo->res_agent == NULL) {

View File

@ -878,7 +878,26 @@ bcma_erom_parse_corecfg(struct bcma_erom *erom, struct bcma_corecfg **result)
for (uint8_t i = 0; i < core.num_swrap; i++) { for (uint8_t i = 0; i < core.num_swrap; i++) {
/* Slave wrapper ports are not numbered distinctly from master /* Slave wrapper ports are not numbered distinctly from master
* wrapper ports. */ * 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, error = erom_corecfg_fill_port_regions(erom, cfg, sp_num,
BCMA_EROM_REGION_TYPE_SWRAP); BCMA_EROM_REGION_TYPE_SWRAP);