diff options
Diffstat (limited to 'sim/bfin/dv-bfin_pll.c')
-rw-r--r-- | sim/bfin/dv-bfin_pll.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sim/bfin/dv-bfin_pll.c b/sim/bfin/dv-bfin_pll.c index 7729180..304d01a 100644 --- a/sim/bfin/dv-bfin_pll.c +++ b/sim/bfin/dv-bfin_pll.c @@ -59,6 +59,10 @@ bfin_pll_io_write_buffer (struct hw *me, const void *source, bu32 *value32p; void *valuep; + /* Invalid access mode is higher priority than missing register. */ + if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, true)) + return 0; + if (nr_bytes == 4) value = dv_load_4 (source); else @@ -74,12 +78,14 @@ bfin_pll_io_write_buffer (struct hw *me, const void *source, switch (mmr_off) { case mmr_offset(pll_stat): - dv_bfin_mmr_require_16 (me, addr, nr_bytes, true); + if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, true)) + return 0; case mmr_offset(chipid): /* Discard writes. */ break; default: - dv_bfin_mmr_require_16 (me, addr, nr_bytes, true); + if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, true)) + return 0; *value16p = value; break; } @@ -97,6 +103,10 @@ bfin_pll_io_read_buffer (struct hw *me, void *dest, bu16 *value16p; void *valuep; + /* Invalid access mode is higher priority than missing register. */ + if (!dv_bfin_mmr_require_16_32 (me, addr, nr_bytes, false)) + return 0; + mmr_off = addr - pll->base; valuep = (void *)((unsigned long)pll + mmr_base() + mmr_off); value16p = valuep; @@ -110,7 +120,8 @@ bfin_pll_io_read_buffer (struct hw *me, void *dest, dv_store_4 (dest, *value32p); break; default: - dv_bfin_mmr_require_16 (me, addr, nr_bytes, false); + if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, false)) + return 0; dv_store_2 (dest, *value16p); break; } |