Message ID | 20170206233931.14921-3-f4bug@amsat.org |
---|---|
State | Superseded, archived |
Headers | show |
On Mon, Feb 6, 2017 at 3:39 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > The register_read() function expects a bitmask argument. > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> The functionality of these two patches looks good to me. I think it's weird that we convert the write function in one patch (when we add the function) and the read in another. I think both patches should just be squashed together. It's a pretty small change. Thanks, Alistair > --- > hw/core/register.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/core/register.c b/hw/core/register.c > index 12f4c1e62d..482e3f827a 100644 > --- a/hw/core/register.c > +++ b/hw/core/register.c > @@ -213,6 +213,7 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, > RegisterInfoArray *reg_array = opaque; > RegisterInfo *reg = NULL; > uint64_t read_val; > + uint64_t re; > int i; > > for (i = 0; i < reg_array->num_elements; i++) { > @@ -228,7 +229,10 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, > return 0; > } > > - read_val = register_read(reg, size * 8, reg_array->prefix, > + /* Generate appropriate read enable mask */ > + re = register_enabled_mask(reg->data_size, size); > + > + read_val = register_read(reg, re, reg_array->prefix, > reg_array->debug); > > return extract64(read_val, 0, size * 8); > -- > 2.11.0 > >
On 02/10/2017 07:19 PM, Alistair Francis wrote: > On Mon, Feb 6, 2017 at 3:39 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: >> The register_read() function expects a bitmask argument. >> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > > The functionality of these two patches looks good to me. > > I think it's weird that we convert the write function in one patch > (when we add the function) and the read in another. > > I think both patches should just be squashed together. It's a pretty > small change. > > Thanks, > > Alistair Sure, will do in v2. Thanks! > >> --- >> hw/core/register.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/hw/core/register.c b/hw/core/register.c >> index 12f4c1e62d..482e3f827a 100644 >> --- a/hw/core/register.c >> +++ b/hw/core/register.c >> @@ -213,6 +213,7 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, >> RegisterInfoArray *reg_array = opaque; >> RegisterInfo *reg = NULL; >> uint64_t read_val; >> + uint64_t re; >> int i; >> >> for (i = 0; i < reg_array->num_elements; i++) { >> @@ -228,7 +229,10 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, >> return 0; >> } >> >> - read_val = register_read(reg, size * 8, reg_array->prefix, >> + /* Generate appropriate read enable mask */ >> + re = register_enabled_mask(reg->data_size, size); >> + >> + read_val = register_read(reg, re, reg_array->prefix, >> reg_array->debug); >> >> return extract64(read_val, 0, size * 8); >> -- >> 2.11.0 >> >>
diff --git a/hw/core/register.c b/hw/core/register.c index 12f4c1e62d..482e3f827a 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -213,6 +213,7 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, RegisterInfoArray *reg_array = opaque; RegisterInfo *reg = NULL; uint64_t read_val; + uint64_t re; int i; for (i = 0; i < reg_array->num_elements; i++) { @@ -228,7 +229,10 @@ uint64_t register_read_memory(void *opaque, hwaddr addr, return 0; } - read_val = register_read(reg, size * 8, reg_array->prefix, + /* Generate appropriate read enable mask */ + re = register_enabled_mask(reg->data_size, size); + + read_val = register_read(reg, re, reg_array->prefix, reg_array->debug); return extract64(read_val, 0, size * 8);
The register_read() function expects a bitmask argument. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/core/register.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)