Add MIPS boot support for the BCM4706/Northstar ChipCommon core.
This adds support for matching against a core lookup table when performing early boot core lookup, and includes the BCM4706/Northstar-specific ChipCommon core ID in the set of supported ChipCommon cores. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D10033
This commit is contained in:
parent
e683c328f8
commit
b86f80276b
@ -98,9 +98,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
static int bcm_init_platform_data(struct bcm_platform *bp);
|
static int bcm_init_platform_data(struct bcm_platform *bp);
|
||||||
|
|
||||||
static int bcm_find_core(struct bcm_platform *bp, uint16_t vendor,
|
static int bcm_find_core(struct bcm_platform *bp,
|
||||||
uint16_t device, int unit, struct bhnd_core_info *info,
|
const struct bhnd_core_match *descs, size_t num_descs,
|
||||||
uintptr_t *addr);
|
struct bhnd_core_info *info, uintptr_t *addr);
|
||||||
|
|
||||||
static int bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls,
|
static int bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls,
|
||||||
kobj_ops_t erom_ops, bhnd_erom_t *erom, size_t esize,
|
kobj_ops_t erom_ops, bhnd_erom_t *erom, size_t esize,
|
||||||
@ -112,6 +112,15 @@ extern int *end;
|
|||||||
static struct bcm_platform bcm_platform_data;
|
static struct bcm_platform bcm_platform_data;
|
||||||
static bool bcm_platform_data_avail = false;
|
static bool bcm_platform_data_avail = false;
|
||||||
|
|
||||||
|
static const struct bhnd_core_match bcm_chipc_cores[] = {
|
||||||
|
{ BHND_MATCH_CORE(BHND_MFGID_BCM, BHND_COREID_CC) },
|
||||||
|
{ BHND_MATCH_CORE(BHND_MFGID_BCM, BHND_COREID_4706_CC) },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct bhnd_core_match bcm_pmu_cores[] = {
|
||||||
|
{ BHND_MATCH_CORE(BHND_MFGID_BCM, BHND_COREID_PMU) },
|
||||||
|
};
|
||||||
|
|
||||||
struct bcm_platform *
|
struct bcm_platform *
|
||||||
bcm_get_platform(void)
|
bcm_get_platform(void)
|
||||||
{
|
{
|
||||||
@ -133,39 +142,41 @@ bcm_get_bus_addr(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search the device enumeration table for a core matching @p vendor,
|
* Search the device enumeration table for a core matching @p descs,
|
||||||
* @p device, and @p unit.
|
|
||||||
*
|
*
|
||||||
* @param bp Platform state containing a valid EROM parser.
|
* @param bp Platform state containing a valid EROM parser.
|
||||||
* @param vendor The core's required vendor.
|
* @param descs The core match descriptor table.
|
||||||
* @param device The core's required device id.
|
* @param num_descs The number of match descriptors in @p descs.
|
||||||
* @param unit The core's required unit number.
|
|
||||||
* @param[out] info If non-NULL, will be populated with the core
|
* @param[out] info If non-NULL, will be populated with the core
|
||||||
* info.
|
* info.
|
||||||
* @param[out] addr If non-NULL, will be populated with the core's
|
* @param[out] addr If non-NULL, will be populated with the core's
|
||||||
* physical register address.
|
* physical register address.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
bcm_find_core(struct bcm_platform *bp, uint16_t vendor, uint16_t device,
|
bcm_find_core(struct bcm_platform *bp, const struct bhnd_core_match *descs,
|
||||||
int unit, struct bhnd_core_info *info, uintptr_t *addr)
|
size_t num_descs, struct bhnd_core_info *info, uintptr_t *addr)
|
||||||
{
|
{
|
||||||
struct bhnd_core_match md;
|
|
||||||
bhnd_addr_t b_addr;
|
bhnd_addr_t b_addr;
|
||||||
bhnd_size_t b_size;
|
bhnd_size_t b_size;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
md = (struct bhnd_core_match) {
|
|
||||||
BHND_MATCH_CORE_VENDOR(vendor),
|
|
||||||
BHND_MATCH_CORE_ID(BHND_COREID_CC),
|
|
||||||
BHND_MATCH_CORE_UNIT(0)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Fetch core info */
|
/* Fetch core info */
|
||||||
error = bhnd_erom_lookup_core_addr(&bp->erom.obj, &md, BHND_PORT_DEVICE,
|
for (size_t i = 0; i < num_descs; i++) {
|
||||||
0, 0, info, &b_addr, &b_size);
|
error = bhnd_erom_lookup_core_addr(&bp->erom.obj, &descs[i],
|
||||||
if (error)
|
BHND_PORT_DEVICE, 0, 0, info, &b_addr, &b_size);
|
||||||
return (error);
|
|
||||||
|
|
||||||
|
/* Terminate search on first match */
|
||||||
|
if (error == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Terminate on first error (other than core not found) */
|
||||||
|
if (error != ENOENT)
|
||||||
|
return (error);
|
||||||
|
|
||||||
|
/* Continue search ... */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provide the core's base address */
|
||||||
if (addr != NULL && b_addr > UINTPTR_MAX) {
|
if (addr != NULL && b_addr > UINTPTR_MAX) {
|
||||||
BCM_ERR("core address %#jx overflows native address width\n",
|
BCM_ERR("core address %#jx overflows native address width\n",
|
||||||
(uintmax_t)b_addr);
|
(uintmax_t)b_addr);
|
||||||
@ -286,8 +297,8 @@ bcm_init_platform_data(struct bcm_platform *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch chipcommon core info */
|
/* Fetch chipcommon core info */
|
||||||
error = bcm_find_core(bp, BHND_MFGID_BCM, BHND_COREID_CC, 0, &bp->cc_id,
|
error = bcm_find_core(bp, bcm_chipc_cores, nitems(bcm_chipc_cores),
|
||||||
&bp->cc_addr);
|
&bp->cc_id, &bp->cc_addr);
|
||||||
if (error) {
|
if (error) {
|
||||||
BCM_ERR("error locating chipc core: %d\n", error);
|
BCM_ERR("error locating chipc core: %d\n", error);
|
||||||
return (error);
|
return (error);
|
||||||
@ -306,9 +317,8 @@ bcm_init_platform_data(struct bcm_platform *bp)
|
|||||||
|
|
||||||
if (pmu && aob) {
|
if (pmu && aob) {
|
||||||
/* PMU block mapped to a PMU core on the Always-on-Bus (aob) */
|
/* PMU block mapped to a PMU core on the Always-on-Bus (aob) */
|
||||||
error = bcm_find_core(bp, BHND_MFGID_BCM, BHND_COREID_PMU, 0,
|
error = bcm_find_core(bp, bcm_pmu_cores, nitems(bcm_pmu_cores),
|
||||||
&bp->pmu_id, &bp->pmu_addr);
|
&bp->pmu_id, &bp->pmu_addr);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
BCM_ERR("error locating pmu core: %d\n", error);
|
BCM_ERR("error locating pmu core: %d\n", error);
|
||||||
return (error);
|
return (error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user