mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-08 21:28:13 +00:00
net/cadence_gem: Fix register w1c logic
This write-1-clear logic was incorrect. It was always clearing w1c bits regardless of whether the written value was 1 or not. i.e. it was implementing a write-anything-to-clear strategy. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: ed905b04d3343966ded425f06aa2224bc7a35b59.1386136219.git.peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
191946c51f
commit
e2314fda62
@ -1112,15 +1112,14 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val,
|
||||
|
||||
/* Squash bits which are read only in write value */
|
||||
val &= ~(s->regs_ro[offset]);
|
||||
/* Preserve (only) bits which are read only in register */
|
||||
readonly = s->regs[offset];
|
||||
readonly &= s->regs_ro[offset];
|
||||
|
||||
/* Squash bits which are write 1 to clear */
|
||||
val &= ~(s->regs_w1c[offset] & val);
|
||||
/* Preserve (only) bits which are read only and wtc in register */
|
||||
readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]);
|
||||
|
||||
/* Copy register write to backing store */
|
||||
s->regs[offset] = val | readonly;
|
||||
s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly;
|
||||
|
||||
/* do w1c */
|
||||
s->regs[offset] &= ~(s->regs_w1c[offset] & val);
|
||||
|
||||
/* Handle register write side effects */
|
||||
switch (offset) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user