diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-27 10:59:21 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-27 10:59:21 +0000 |
commit | 81e976bfaf2d33bac0d995116f8c91450fb60814 (patch) | |
tree | a47bab5d9e40dffb8c5793b98a8c26605a30dd30 /sys | |
parent | ea4080d9564083c4a5c54408dd9f46063cd287b7 (diff) |
Handle trailing odd-sized 1024 byte blocks when calculating TCM RAM size.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/bwfm.c | 10 | ||||
-rw-r--r-- | sys/dev/ic/bwfmreg.h | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index e9ccba46005..1087892bfb1 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.93 2021/12/26 20:50:17 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.94 2021/12/27 10:59:20 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -1526,7 +1526,7 @@ bwfm_chip_sysmem_ramsize(struct bwfm_softc *sc, struct bwfm_core *core) void bwfm_chip_tcm_ramsize(struct bwfm_softc *sc, struct bwfm_core *core) { - uint32_t cap, nab, nbb, totb, bxinfo, ramsize = 0; + uint32_t cap, nab, nbb, totb, bxinfo, blksize, ramsize = 0; int i; cap = sc->sc_buscore_ops->bc_read(sc, core->co_base + BWFM_ARMCR4_CAP); @@ -1539,8 +1539,12 @@ bwfm_chip_tcm_ramsize(struct bwfm_softc *sc, struct bwfm_core *core) core->co_base + BWFM_ARMCR4_BANKIDX, i); bxinfo = sc->sc_buscore_ops->bc_read(sc, core->co_base + BWFM_ARMCR4_BANKINFO); + if (bxinfo & BWFM_ARMCR4_BANKINFO_BLK_1K_MASK) + blksize = 1024; + else + blksize = 8192; ramsize += ((bxinfo & BWFM_ARMCR4_BANKINFO_BSZ_MASK) + 1) * - BWFM_ARMCR4_BANKINFO_BSZ_MULT; + blksize; } sc->sc_chip.ch_ramsize = ramsize; diff --git a/sys/dev/ic/bwfmreg.h b/sys/dev/ic/bwfmreg.h index 4bfbc298ee6..0f728a06c0a 100644 --- a/sys/dev/ic/bwfmreg.h +++ b/sys/dev/ic/bwfmreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfmreg.h,v 1.22 2021/12/26 20:50:17 patrick Exp $ */ +/* $OpenBSD: bwfmreg.h,v 1.23 2021/12/27 10:59:20 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -87,8 +87,8 @@ #define BWFM_ARMCR4_CAP_TCBBNB_SHIFT 4 #define BWFM_ARMCR4_BANKIDX 0x0040 #define BWFM_ARMCR4_BANKINFO 0x0044 -#define BWFM_ARMCR4_BANKINFO_BSZ_MASK 0x3f -#define BWFM_ARMCR4_BANKINFO_BSZ_MULT 8192 +#define BWFM_ARMCR4_BANKINFO_BSZ_MASK 0x7f +#define BWFM_ARMCR4_BANKINFO_BLK_1K_MASK 0x200 #define BWFM_ARMCR4_BANKPDA 0x004C /* GCI (OTP) registers */ |