diff options
author | Landon J. Fuller <landonf@FreeBSD.org> | 2016-09-03 23:57:17 +0000 |
---|---|---|
committer | Landon J. Fuller <landonf@FreeBSD.org> | 2016-09-03 23:57:17 +0000 |
commit | 664a74970833402c37182bc52d64175f4750cbfa (patch) | |
tree | 9609d2f7bf1c0467348de94bc8c40b93f787bcd2 /sys/mips/broadcom | |
parent | cd3912b6be0c28ff45f3d8853d69abf3e08e7d18 (diff) | |
download | src-664a74970833402c37182bc52d64175f4750cbfa.tar.gz src-664a74970833402c37182bc52d64175f4750cbfa.zip |
Implement a generic bhnd(4) device enumeration table API.
This defines a new bhnd_erom_if API, providing a common interface to device
enumeration on siba(4) and bcma(4) devices, for use both in the bhndb bridge
and SoC early boot contexts, and migrates mips/broadcom over to the new API.
This also replaces the previous adhoc device enumeration support implemented
for mips/broadcom.
Migration of bhndb to the new API will be implemented in a follow-up commit.
- Defined new bhnd_erom_if interface for bhnd(4) device enumeration, along
with bcma(4) and siba(4)-specific implementations.
- Fixed a minor bug in bhndb that logged an error when we attempted to map the
full siba(4) bus space (18000000-17FFFFFF) in the siba EROM parser.
- Reverted use of the resource's start address as the ChipCommon enum_addr in
bhnd_read_chipid(). When called from bhndb, this address is found within the
host address space, resulting in an invalid bridged enum_addr.
- Added support for falling back on standard bus_activate_resource() in
bhnd_bus_generic_activate_resource(), enabling allocation of the bhnd_erom's
bhnd_resource directly from a nexus-attached bhnd(4) device.
- Removed BHND_BUS_GET_CORE_TABLE(); it has been replaced by the erom API.
- Added support for statically initializing bhnd_erom instances, for use prior
to malloc availability. The statically allocated buffer size is verified both
at runtime, and via a compile-time assertion (see BHND_EROM_STATIC_BYTES).
- bhnd_erom classes are registered within a module via a linker set, allowing
mips/broadcom to probe available EROM parser instances without creating a
strong reference to bcma/siba-specific symbols.
- Migrated mips/broadcom to bhnd_erom_if, replacing the previous MIPS-specific
device enumeration implementation.
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D7748
Notes
Notes:
svn path=/head/; revision=305366
Diffstat (limited to 'sys/mips/broadcom')
-rw-r--r-- | sys/mips/broadcom/bcm_bcma.c | 100 | ||||
-rw-r--r-- | sys/mips/broadcom/bcm_machdep.c | 253 | ||||
-rw-r--r-- | sys/mips/broadcom/bcm_machdep.h | 37 | ||||
-rw-r--r-- | sys/mips/broadcom/bcm_pmu.c | 8 | ||||
-rw-r--r-- | sys/mips/broadcom/bcm_siba.c | 64 | ||||
-rw-r--r-- | sys/mips/broadcom/files.broadcom | 2 |
6 files changed, 195 insertions, 269 deletions
diff --git a/sys/mips/broadcom/bcm_bcma.c b/sys/mips/broadcom/bcm_bcma.c deleted file mode 100644 index 08ff97a40e79..000000000000 --- a/sys/mips/broadcom/bcm_bcma.c +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * Copyright (c) 2016 Landon Fuller <landonf@FreeBSD.org> - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> - -#include <machine/bus.h> - -#include <dev/bhnd/bhnd.h> -#include <dev/bhnd/bcma/bcma_eromvar.h> - -#include "bcm_machdep.h" - -#define BCMFC_ERR(fmt, ...) printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__) - -int -bcm_find_core_bcma(struct bhnd_chipid *chipid, bhnd_devclass_t devclass, - int unit, struct bhnd_core_info *info, uintptr_t *addr) -{ - struct bcma_erom erom; - struct bcma_erom_core core; - struct bcma_erom_sport_region region; - bhnd_devclass_t core_class; - int error; - - error = bhnd_erom_bus_space_open(&erom, NULL, mips_bus_space_generic, - (bus_space_handle_t) BCM_SOC_ADDR(chipid->enum_addr, 0), 0); - if (error) { - BCMFC_ERR("erom open failed: %d\n", error); - return (error); - } - - for (u_long core_index = 0; core_index < ULONG_MAX; core_index++) { - /* Fetch next core record */ - if ((error = bcma_erom_seek_next_core(&erom))) - return (error); - - if ((error = bcma_erom_parse_core(&erom, &core))) { - BCMFC_ERR("core parse failed: %d\n", error); - return (error); - } - - /* Check for match */ - core_class = bhnd_find_core_class(core.vendor, - core.device); - if (core_class != devclass) - continue; - - /* Provide the basic core info */ - if (info != NULL) - bcma_erom_to_core_info(&core, core_index, 0, info); - - /* Provide the core's device0.0 port address */ - error = bcma_erom_seek_core_sport_region(&erom, core_index, - BHND_PORT_DEVICE, 0, 0); - if (error) { - BCMFC_ERR("sport not found: %d\n", error); - return (error); - } - - if ((error = bcma_erom_parse_sport_region(&erom, ®ion))) { - BCMFC_ERR("sport parse failed: %d\n", error); - return (error); - } - - if (addr != NULL) - *addr = region.base_addr; - - return (0); - } - - /* Not found */ - return (ENOENT); -} diff --git a/sys/mips/broadcom/bcm_machdep.c b/sys/mips/broadcom/bcm_machdep.c index 9a241b898e04..00d4f42f310b 100644 --- a/sys/mips/broadcom/bcm_machdep.c +++ b/sys/mips/broadcom/bcm_machdep.c @@ -96,15 +96,15 @@ __FBSDID("$FreeBSD$"); #define BCM_TRACE(_fmt, ...) #endif -static int bcm_find_core(struct bhnd_chipid *chipid, - bhnd_devclass_t devclass, int unit, - struct bhnd_core_info *info, uintptr_t *addr); -static int bcm_init_platform_data(struct bcm_platform *pdata); +static int bcm_init_platform_data(struct bcm_platform *bp); -/* Allow bus-specific implementations to override bcm_find_core_(bcma|siba) - * symbols, if included in the kernel build */ -__weak_reference(bcm_find_core_default, bcm_find_core_bcma); -__weak_reference(bcm_find_core_default, bcm_find_core_siba); +static int bcm_find_core(struct bcm_platform *bp, uint16_t vendor, + uint16_t device, int unit, struct bhnd_core_info *info, + uintptr_t *addr); + +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, + struct bhnd_chipid *cid); extern int *edata; extern int *end; @@ -121,128 +121,213 @@ bcm_get_platform(void) return (&bcm_platform_data); } -/* Default (no-op) bcm_find_core() implementation. */ -int -bcm_find_core_default(struct bhnd_chipid *chipid, bhnd_devclass_t devclass, - int unit, struct bhnd_core_info *info, uintptr_t *addr) +static bus_addr_t +bcm_get_bus_addr(void) { - return (ENODEV); + long maddr; + + if (resource_long_value("bhnd", 0, "maddr", &maddr) == 0) + return ((u_long)maddr); + + return (BHND_DEFAULT_CHIPC_ADDR); } /** - * Search @p chipid's enumeration table for a core with @p devclass and - * @p unit. + * Search the device enumeration table for a core matching @p vendor, + * @p device, and @p unit. * - * @param chipid Chip identification data, including the address - * of the enumeration table to be searched. - * @param devclass Search for a core matching this device class. + * @param bp Platform state containing a valid EROM parser. + * @param vendor The core's required vendor. + * @param device The core's required device id. * @param unit The core's required unit number. - * @param[out] info On success, will be populated with the core + * @param[out] info If non-NULL, will be populated with the core * info. + * @param[out] addr If non-NULL, will be populated with the core's + * physical register address. + */ +static int +bcm_find_core(struct bcm_platform *bp, uint16_t vendor, uint16_t device, + int unit, struct bhnd_core_info *info, uintptr_t *addr) +{ + struct bhnd_core_match md; + bhnd_addr_t b_addr; + bhnd_size_t b_size; + 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 */ + error = bhnd_erom_lookup_core_addr(&bp->erom.obj, &md, BHND_PORT_DEVICE, + 0, 0, info, &b_addr, &b_size); + if (error) + return (error); + + if (addr != NULL && b_addr > UINTPTR_MAX) { + BCM_ERR("core address %#jx overflows native address width\n", + (uintmax_t)b_addr); + return (ERANGE); + } + + if (addr != NULL) + *addr = b_addr; + + return (0); +} + +/** + * Probe and attach a bhnd_erom parser instance for the bhnd bus. + * + * @param[out] erom_cls The probed EROM class. + * @param[out] erom_ops The storage to be used when compiling + * @p erom_cls. + * @param[out] erom The storage to be used when initializing the + * static instance of @p erom_cls. + * @param esize The total available number of bytes allocated + * for @p erom. If this is less than is required + * by @p erom_cls ENOMEM will be returned. + * @param[out] cid On success, the probed chip identification. */ static int -bcm_find_core(struct bhnd_chipid *chipid, bhnd_devclass_t devclass, int unit, - struct bhnd_core_info *info, uintptr_t *addr) +bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls, kobj_ops_t erom_ops, + bhnd_erom_t *erom, size_t esize, struct bhnd_chipid *cid) { - switch (chipid->chip_type) { - case BHND_CHIPTYPE_SIBA: - return (bcm_find_core_siba(chipid, devclass, unit, info, addr)); - break; - default: - if (!BHND_CHIPTYPE_HAS_EROM(chipid->chip_type)) { - printf("%s: unsupported chip type: %d\n", __FUNCTION__, - chipid->chip_type); - return (ENXIO); + bhnd_erom_class_t **clsp; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_addr_t bus_addr; + int error, prio, result; + + bus_addr = bcm_get_bus_addr(); + *erom_cls = NULL; + prio = 0; + + bst = mips_bus_space_generic; + bsh = BCM_SOC_BSH(bus_addr, 0); + + SET_FOREACH(clsp, bhnd_erom_class_set) { + struct bhnd_chipid pcid; + bhnd_erom_class_t *cls; + struct kobj_ops kops; + + cls = *clsp; + + /* Compile the class' ops table */ + kobj_class_compile_static(cls, &kops); + + /* Probe the bus address */ + result = bhnd_erom_probe_static(cls, bst, bsh, bus_addr, &pcid); + + /* Drop pointer to stack allocated ops table */ + cls->ops = NULL; + + /* The parser did not match if an error was returned */ + if (result > 0) + continue; + + /* Check for a new highest priority match */ + if (*erom_cls == NULL || result > prio) { + prio = result; + + *cid = pcid; + *erom_cls = cls; } - return (bcm_find_core_bcma(chipid, devclass, unit, info, addr)); + + /* Terminate immediately on BUS_PROBE_SPECIFIC */ + if (result == BUS_PROBE_SPECIFIC) + break; + } + + /* Valid EROM class probed? */ + if (*erom_cls == NULL) { + BCM_ERR("no erom parser found for root bus at %#jx\n", + (uintmax_t)bus_addr); + return (ENOENT); } + + /* Using the provided storage, recompile the erom class ... */ + kobj_class_compile_static(*erom_cls, erom_ops); + + /* ... and initialize the erom parser instance */ + bsh = BCM_SOC_BSH(cid->enum_addr, 0); + error = bhnd_erom_init_static(*erom_cls, erom, esize, + mips_bus_space_generic, bsh); + + return (error); } /** * Populate platform configuration data. */ static int -bcm_init_platform_data(struct bcm_platform *pdata) +bcm_init_platform_data(struct bcm_platform *bp) { - uint32_t reg; - bhnd_addr_t enum_addr; - long maddr; - uint8_t chip_type; - bool aob, pmu; - int error; + bool aob, pmu; + int error; /* Fetch CFE console handle (if any). Must be initialized before * any calls to printf/early_putc. */ #ifdef CFE - if ((pdata->cfe_console = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE)) < 0) - pdata->cfe_console = -1; + if ((bp->cfe_console = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE)) < 0) + bp->cfe_console = -1; #endif - /* Fetch bhnd/chipc address */ - if (resource_long_value("bhnd", 0, "maddr", &maddr) == 0) - pdata->cc_addr = (u_long)maddr; - else - pdata->cc_addr = BHND_DEFAULT_CHIPC_ADDR; - - /* Read chip identifier from ChipCommon */ - reg = BCM_SOC_READ_4(pdata->cc_addr, CHIPC_ID); - chip_type = CHIPC_GET_BITS(reg, CHIPC_ID_BUS); - - if (BHND_CHIPTYPE_HAS_EROM(chip_type)) - enum_addr = BCM_SOC_READ_4(pdata->cc_addr, CHIPC_EROMPTR); - else - enum_addr = pdata->cc_addr; - - pdata->id = bhnd_parse_chipid(reg, enum_addr); - - /* Fetch chipc core info and capabilities */ - pdata->cc_caps = BCM_SOC_READ_4(pdata->cc_addr, CHIPC_CAPABILITIES); - - error = bcm_find_core(&pdata->id, BHND_DEVCLASS_CC, 0, &pdata->cc_id, - NULL); + /* Probe and attach device table provider, populating our + * chip identification */ + error = bcm_erom_probe_and_attach(&bp->erom_impl, &bp->erom_ops, + &bp->erom.obj, sizeof(bp->erom), &bp->cid); if (error) { - printf("%s: error locating chipc core: %d", __FUNCTION__, - error); + BCM_ERR("error attaching erom parser: %d\n", error); return (error); } - if (CHIPC_HWREV_HAS_CAP_EXT(pdata->cc_id.hwrev)) { - pdata->cc_caps_ext = BCM_SOC_READ_4(pdata->cc_addr, - CHIPC_CAPABILITIES_EXT); - } else { - pdata->cc_caps_ext = 0x0; + /* Fetch chipcommon core info */ + error = bcm_find_core(bp, BHND_MFGID_BCM, BHND_COREID_CC, 0, &bp->cc_id, + &bp->cc_addr); + if (error) { + BCM_ERR("error locating chipc core: %d\n", error); + return (error); } + /* Fetch chipc capability flags */ + bp->cc_caps = BCM_SOC_READ_4(bp->cc_addr, CHIPC_CAPABILITIES); + bp->cc_caps_ext = 0x0; + + if (CHIPC_HWREV_HAS_CAP_EXT(bp->cc_id.hwrev)) + bp->cc_caps_ext = BCM_CHIPC_READ_4(bp, CHIPC_CAPABILITIES_EXT); + /* Fetch PMU info */ - pmu = CHIPC_GET_FLAG(pdata->cc_caps, CHIPC_CAP_PMU); - aob = CHIPC_GET_FLAG(pdata->cc_caps_ext, CHIPC_CAP2_AOB); + pmu = CHIPC_GET_FLAG(bp->cc_caps, CHIPC_CAP_PMU); + aob = CHIPC_GET_FLAG(bp->cc_caps_ext, CHIPC_CAP2_AOB); if (pmu && aob) { /* PMU block mapped to a PMU core on the Always-on-Bus (aob) */ - error = bcm_find_core(&pdata->id, BHND_DEVCLASS_PMU, 0, - &pdata->pmu_id, &pdata->pmu_addr); + error = bcm_find_core(bp, BHND_MFGID_BCM, BHND_COREID_PMU, 0, + &bp->pmu_id, &bp->pmu_addr); if (error) { - printf("%s: error locating pmu core: %d", __FUNCTION__, - error); + BCM_ERR("error locating pmu core: %d\n", error); return (error); } } else if (pmu) { /* PMU block mapped to chipc */ - pdata->pmu_addr = pdata->cc_addr; - pdata->pmu_id = pdata->cc_id; + bp->pmu_addr = bp->cc_addr; + bp->pmu_id = bp->cc_id; } else { /* No PMU */ - pdata->pmu_addr = 0x0; - memset(&pdata->pmu_id, 0, sizeof(pdata->pmu_id)); + bp->pmu_addr = 0x0; + memset(&bp->pmu_id, 0, sizeof(bp->pmu_id)); } + /* Initialize PMU query state */ if (pmu) { - error = bhnd_pmu_query_init(&pdata->pmu, NULL, pdata->id, - &bcm_pmu_soc_io, pdata); + error = bhnd_pmu_query_init(&bp->pmu, NULL, bp->cid, + &bcm_pmu_soc_io, bp); if (error) { - printf("%s: bhnd_pmu_query_init() failed: %d\n", - __FUNCTION__, error); + BCM_ERR("bhnd_pmu_query_init() failed: %d\n", error); return (error); } } @@ -346,7 +431,7 @@ platform_reset(void) bcm4785war = false; /* Handle BCM4785-specific behavior */ - if (bp->id.chip_id == BHND_CHIPID_BCM4785) { + if (bp->cid.chip_id == BHND_CHIPID_BCM4785) { bcm4785war = true; /* Switch to async mode */ diff --git a/sys/mips/broadcom/bcm_machdep.h b/sys/mips/broadcom/bcm_machdep.h index d8d551f3ac1a..84aed350874f 100644 --- a/sys/mips/broadcom/bcm_machdep.h +++ b/sys/mips/broadcom/bcm_machdep.h @@ -36,29 +36,34 @@ #include <machine/cpuregs.h> #include <dev/bhnd/bhnd.h> +#include <dev/bhnd/bhnd_erom.h> + #include <dev/bhnd/cores/pmu/bhnd_pmuvar.h> extern const struct bhnd_pmu_io bcm_pmu_soc_io; -typedef int (bcm_bus_find_core)(struct bhnd_chipid *chipid, - bhnd_devclass_t devclass, int unit, struct bhnd_core_info *info, - uintptr_t *addr); - struct bcm_platform { - struct bhnd_chipid id; /**< chip id */ - struct bhnd_core_info cc_id; /**< chipc core info */ - uintptr_t cc_addr; /**< chipc core phys address */ - uint32_t cc_caps; /**< chipc capabilities */ - uint32_t cc_caps_ext; /**< chipc extended capabilies */ + struct bhnd_chipid cid; /**< chip id */ + struct bhnd_core_info cc_id; /**< chipc core info */ + uintptr_t cc_addr; /**< chipc core phys address */ + uint32_t cc_caps; /**< chipc capabilities */ + uint32_t cc_caps_ext; /**< chipc extended capabilies */ /* On non-AOB devices, the PMU register block is mapped to chipc; * the pmu_id and pmu_addr values will be copied from cc_id * and cc_addr. */ - struct bhnd_core_info pmu_id; /**< PMU core info */ - uintptr_t pmu_addr; /**< PMU core phys address, or + struct bhnd_core_info pmu_id; /**< PMU core info */ + uintptr_t pmu_addr; /**< PMU core phys address, or 0x0 if no PMU */ - struct bhnd_pmu_query pmu; /**< PMU query instance */ + struct bhnd_pmu_query pmu; /**< PMU query instance */ + + bhnd_erom_class_t *erom_impl; /**< erom parser class */ + struct kobj_ops erom_ops; /**< compiled kobj opcache */ + union { + bhnd_erom_static_t data; + bhnd_erom_t obj; + } erom; #ifdef CFE int cfe_console; /**< Console handle, or -1 */ @@ -74,9 +79,11 @@ uint64_t bcm_get_ilpfreq(struct bcm_platform *bp); u_int bcm_get_uart_rclk(struct bcm_platform *bp); -bcm_bus_find_core bcm_find_core_default; -bcm_bus_find_core bcm_find_core_bcma; -bcm_bus_find_core bcm_find_core_siba; +#define BCM_ERR(fmt, ...) \ + printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__) + +#define BCM_SOC_BSH(_addr, _offset) \ + ((bus_space_handle_t)BCM_SOC_ADDR((_addr), (_offset))) #define BCM_SOC_ADDR(_addr, _offset) \ MIPS_PHYS_TO_KSEG1((_addr) + (_offset)) diff --git a/sys/mips/broadcom/bcm_pmu.c b/sys/mips/broadcom/bcm_pmu.c index 9ded7cc3840f..46fa70da5902 100644 --- a/sys/mips/broadcom/bcm_pmu.c +++ b/sys/mips/broadcom/bcm_pmu.c @@ -239,14 +239,14 @@ bcm_get_cpufreq(struct bcm_platform *bp) * PWRCTL support */ pll_type = CHIPC_GET_BITS(bp->cc_caps, CHIPC_CAP_PLL); - mreg = bhnd_pwrctl_cpu_clkreg_m(&bp->id, pll_type, &fixed_hz); + mreg = bhnd_pwrctl_cpu_clkreg_m(&bp->cid, pll_type, &fixed_hz); if (mreg == 0) return (fixed_hz); n = BCM_CHIPC_READ_4(bp, CHIPC_CLKC_N); m = BCM_CHIPC_READ_4(bp, mreg); - return (bhnd_pwrctl_cpu_clock_rate(&bp->id, pll_type, n, m)); + return (bhnd_pwrctl_cpu_clock_rate(&bp->cid, pll_type, n, m)); } @@ -267,14 +267,14 @@ bcm_get_sifreq(struct bcm_platform *bp) * PWRCTL support */ pll_type = CHIPC_GET_BITS(bp->cc_caps, CHIPC_CAP_PLL); - mreg = bhnd_pwrctl_si_clkreg_m(&bp->id, pll_type, &fixed_hz); + mreg = bhnd_pwrctl_si_clkreg_m(&bp->cid, pll_type, &fixed_hz); if (mreg == 0) return (fixed_hz); n = BCM_CHIPC_READ_4(bp, CHIPC_CLKC_N); m = BCM_CHIPC_READ_4(bp, mreg); - return (bhnd_pwrctl_si_clock_rate(&bp->id, pll_type, n, m)); + return (bhnd_pwrctl_si_clock_rate(&bp->cid, pll_type, n, m)); } diff --git a/sys/mips/broadcom/bcm_siba.c b/sys/mips/broadcom/bcm_siba.c deleted file mode 100644 index ff8fa09a564c..000000000000 --- a/sys/mips/broadcom/bcm_siba.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 2016 Landon Fuller <landonf@FreeBSD.org> - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dev/bhnd/bhnd.h> -#include <dev/bhnd/bhndreg.h> - -#include <dev/bhnd/siba/sibareg.h> -#include <dev/bhnd/siba/sibavar.h> - -#include "bcm_machdep.h" - -int -bcm_find_core_siba(struct bhnd_chipid *chipid, bhnd_devclass_t devclass, - int unit, struct bhnd_core_info *info, uintptr_t *addr) -{ - struct siba_core_id scid; - uintptr_t cc_addr; - uint32_t idhigh, idlow; - - /* No other cores are required during early boot on siba(4) devices */ - if (devclass != BHND_DEVCLASS_CC || unit != 0) - return (ENOENT); - - cc_addr = chipid->enum_addr; - idhigh = BCM_SOC_READ_4(cc_addr, SB0_REG_ABS(SIBA_CFG0_IDHIGH)); - idlow = BCM_SOC_READ_4(cc_addr, SB0_REG_ABS(SIBA_CFG0_IDHIGH)); - - scid = siba_parse_core_id(idhigh, idlow, 0, 0); - - if (info != NULL) - *info = scid.core_info; - - if (addr != NULL) - *addr = cc_addr; - - return (0); -} diff --git a/sys/mips/broadcom/files.broadcom b/sys/mips/broadcom/files.broadcom index 61b120073e48..ddef0a307102 100644 --- a/sys/mips/broadcom/files.broadcom +++ b/sys/mips/broadcom/files.broadcom @@ -4,10 +4,8 @@ # for USB 1.1 OHCI, Ethernet and IPSEC cores # which are believed to be devices we have drivers for # which just need to be tweaked for attachment to an BHND system bus. -mips/broadcom/bcm_bcma.c optional bcma_nexus bcma mips/broadcom/bcm_machdep.c standard mips/broadcom/bcm_pmu.c standard -mips/broadcom/bcm_siba.c optional siba_nexus siba mips/mips/tick.c standard mips/mips/mips_pic.c standard kern/subr_intr.c standard |