git: 91abbc4993a5 - main - [mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID
Michael Zhilin
mizhka at FreeBSD.org
Fri May 28 20:36:09 UTC 2021
The branch main has been updated by mizhka:
URL: https://cgit.FreeBSD.org/src/commit/?id=91abbc4993a5964badd21bc691ae273a1a2d9c20
commit 91abbc4993a5964badd21bc691ae273a1a2d9c20
Author: Michael Zhilin <mizhka at FreeBSD.org>
AuthorDate: 2021-05-28 20:32:30 +0000
Commit: Michael Zhilin <mizhka at FreeBSD.org>
CommitDate: 2021-05-28 20:35:37 +0000
[mips/broadcom] set sysctl "hw.model" by SoC ChipCommon ID
Small patch to set "hw.model" by SoC ChipCommon ID. On BCM4718 it will be BCM4716, because 4716 is core for 4716,4717 & 4718.
Tested on Netgear WNR3500L (BCM4718) and Asus RT-N53 (BCM5357).
Reviewed by: landonf, yamori813 at yahoo.co.jp
Sponsored by: Postgres Professional
Differential revision: https://reviews.freebsd.org/D12737
---
sys/mips/broadcom/bcm_machdep.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sys/mips/broadcom/bcm_machdep.c b/sys/mips/broadcom/bcm_machdep.c
index 20ae22f2e9b0..581fffdd899d 100644
--- a/sys/mips/broadcom/bcm_machdep.c
+++ b/sys/mips/broadcom/bcm_machdep.c
@@ -116,6 +116,9 @@ static int bcm_erom_probe_and_attach(bhnd_erom_class_t **erom_cls,
extern int *edata;
extern int *end;
+/* from sys/mips/mips/machdep.c */
+extern char cpu_model[];
+
static struct bcm_platform bcm_platform_data;
static bool bcm_platform_data_avail = false;
@@ -399,6 +402,12 @@ bcm_init_platform_data(struct bcm_platform *bp)
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)
+ 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 */
bp->cc_caps = BCM_SOC_READ_4(bp->cc_addr, CHIPC_CAPABILITIES);
bp->cc_caps_ext = 0x0;
More information about the dev-commits-src-main
mailing list