Changeset View
Standalone View
sys/mips/broadcom/bcm_machdep.c
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
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, | ||||
struct bhnd_erom_io *eio, struct bhnd_chipid *cid); | struct bhnd_erom_io *eio, struct bhnd_chipid *cid); | ||||
extern int *edata; | extern int *edata; | ||||
extern int *end; | extern int *end; | ||||
/* from sys/mips/mips/machdep.c */ | |||||
extern char cpu_model[]; | |||||
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; | ||||
#ifdef CFE | #ifdef CFE | ||||
static struct bcm_nvram_iocfe bcm_cfe_nvram; | static struct bcm_nvram_iocfe bcm_cfe_nvram; | ||||
#endif | #endif | ||||
static const struct bhnd_core_match bcm_chipc_cores[] = { | static const struct bhnd_core_match bcm_chipc_cores[] = { | ||||
▲ Show 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | #endif /* CFE */ | ||||
/* Fetch chipcommon core info */ | /* Fetch chipcommon core info */ | ||||
error = bcm_find_core(bp, bcm_chipc_cores, nitems(bcm_chipc_cores), | error = bcm_find_core(bp, bcm_chipc_cores, nitems(bcm_chipc_cores), | ||||
&bp->cc_id, &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); | ||||
} | } | ||||
/* All hex formatted IDs are within the range of 0x4000-0x9C3F (40000-1) */ | |||||
if (bp->cid.chip_id >= 0x4000 && bp->cid.chip_id <= 0x9C3F) | |||||
landonf: Is `bhnd_format_chip_id()` usable here? | |||||
Not Done Inline ActionsThis is broadcom machdep, so I don't want implicit dependence from kernel on BHND. Logic is simple and small, so copy-paste of code looks better than compile dependence. BTW, BHND can be loaded as module, so dependence is not good. mizhka: This is broadcom machdep, so I don't want implicit dependence from kernel on BHND. Logic is… | |||||
Not Done Inline ActionsFWIW, the kernel (via broadcom machdep) already have a number of hard dependencies on BHND for PMU/PWRCTL support, device enumeration, and NVRAM parsing support. It'd be rather difficult to separate the two without reproducing a lot of the bhnd(4) platform support code that is common across MIPS/ARM/Wi-Fi targets. landonf: FWIW, the kernel (via broadcom machdep) already have a number of hard dependencies on BHND for… | |||||
Not Done Inline ActionsOn DSL/cable platforms there is no BHND and CFE, but chipcommon is same. I agree that as of now there is hard points to avoid bhnd, but it may be worth to copy chipid printing suitable for all broadcom cases. P.S. Small correction: DSL modems are CFE based, but there is no bcma here. AFAIK Old ones uses siba, but new ones are more FTD friendly. Cable modem has strangle bootloader, not CFE mizhka: On DSL/cable platforms there is no BHND and CFE, but chipcommon is same. I agree that as of now… | |||||
Not Done Inline ActionsYeah, the DSL/Cable modems seem to be odd ducks. Later DSL and cable modem SoCs appear(ed) to use what Broadcom calls "ubus", which is seemingly nearly (but not quite) identical to BCMA. They seem to be moving away from that in the more recent ARM DSL/Cable SoCs? (I haven't investigated in significant detail). I'd honestly still prefer using bhnd_format_chip_id here, but it doesn't seem worth sweating over. landonf: Yeah, the DSL/Cable modems seem to be odd ducks. Later DSL and cable modem SoCs appear(ed) to… | |||||
snprintf(cpu_model, 10, "BCM%hX", bp->cid.chip_id); | |||||
else | |||||
snprintf(cpu_model, 10, "BCM%hu", bp->cid.chip_id); | |||||
/* Fetch chipc capability flags */ | /* Fetch chipc capability flags */ | ||||
bp->cc_caps = BCM_SOC_READ_4(bp->cc_addr, CHIPC_CAPABILITIES); | bp->cc_caps = BCM_SOC_READ_4(bp->cc_addr, CHIPC_CAPABILITIES); | ||||
bp->cc_caps_ext = 0x0; | bp->cc_caps_ext = 0x0; | ||||
if (CHIPC_HWREV_HAS_CAP_EXT(bp->cc_id.hwrev)) | if (CHIPC_HWREV_HAS_CAP_EXT(bp->cc_id.hwrev)) | ||||
bp->cc_caps_ext = BCM_CHIPC_READ_4(bp, CHIPC_CAPABILITIES_EXT); | bp->cc_caps_ext = BCM_CHIPC_READ_4(bp, CHIPC_CAPABILITIES_EXT); | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |
Is bhnd_format_chip_id() usable here?