diff mbox

[v2,04/16] register: Add support for decoding information

Message ID ec8f436c5d15f832125e0f72a011e89c63d1d8b7.1453237258.git.alistair.francis@xilinx.com
State New
Headers show

Commit Message

Alistair Francis Jan. 19, 2016, 10:35 p.m. UTC
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Allow defining of optional address decoding information in register
definitions. This is useful for clients that want to associate
registers with specific addresses.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
---
changed since v4:
Remove extraneous unused defintions.

 include/hw/register.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

fred.konrad@greensocs.com Jan. 27, 2016, 3:09 p.m. UTC | #1
Le 19/01/2016 23:35, Alistair Francis a écrit :
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Allow defining of optional address decoding information in register
> definitions. This is useful for clients that want to associate
> registers with specific addresses.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
> changed since v4:
> Remove extraneous unused defintions.
>
>   include/hw/register.h | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/include/hw/register.h b/include/hw/register.h
> index a3c41db..90c0185 100644
> --- a/include/hw/register.h
> +++ b/include/hw/register.h
> @@ -54,6 +54,11 @@ typedef struct RegisterAccessError {
>    * allowing this function to modify the value before return to the client.
>    */
>   
> +#define REG_DECODE_READ (1 << 0)
> +#define REG_DECODE_WRITE (1 << 1)
> +#define REG_DECODE_EXECUTE (1 << 2)
> +#define REG_DECODE_RW (REG_DECODE_READ | REG_DECODE_WRITE)
> +
>   struct RegisterAccessInfo {
>       const char *name;
>       uint64_t ro;
> @@ -71,6 +76,11 @@ struct RegisterAccessInfo {
>       void (*post_write)(RegisterInfo *reg, uint64_t val);
>   
>       uint64_t (*post_read)(RegisterInfo *reg, uint64_t val);
> +
> +    struct {
> +        hwaddr addr;
> +        uint8_t flags;
> +    } decode;
is that used somewhere?

Fred
>   };
>   
>   /**
Alistair Francis Jan. 29, 2016, 11:30 p.m. UTC | #2
On Wed, Jan 27, 2016 at 7:09 AM, KONRAD Frederic
<fred.konrad@greensocs.com> wrote:
>
>
> Le 19/01/2016 23:35, Alistair Francis a écrit :
>>
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Allow defining of optional address decoding information in register
>> definitions. This is useful for clients that want to associate
>> registers with specific addresses.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> ---
>> changed since v4:
>> Remove extraneous unused defintions.
>>
>>   include/hw/register.h | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/include/hw/register.h b/include/hw/register.h
>> index a3c41db..90c0185 100644
>> --- a/include/hw/register.h
>> +++ b/include/hw/register.h
>> @@ -54,6 +54,11 @@ typedef struct RegisterAccessError {
>>    * allowing this function to modify the value before return to the
>> client.
>>    */
>>   +#define REG_DECODE_READ (1 << 0)
>> +#define REG_DECODE_WRITE (1 << 1)
>> +#define REG_DECODE_EXECUTE (1 << 2)
>> +#define REG_DECODE_RW (REG_DECODE_READ | REG_DECODE_WRITE)
>> +
>>   struct RegisterAccessInfo {
>>       const char *name;
>>       uint64_t ro;
>> @@ -71,6 +76,11 @@ struct RegisterAccessInfo {
>>       void (*post_write)(RegisterInfo *reg, uint64_t val);
>>         uint64_t (*post_read)(RegisterInfo *reg, uint64_t val);
>> +
>> +    struct {
>> +        hwaddr addr;
>> +        uint8_t flags;
>> +    } decode;
>
> is that used somewhere?

The addr variable is used in future patches, although flags isn't. I'm
removing the flags variable.

Thanks,

Alistair

>
> Fred
>>
>>   };
>>     /**
>
>
>
diff mbox

Patch

diff --git a/include/hw/register.h b/include/hw/register.h
index a3c41db..90c0185 100644
--- a/include/hw/register.h
+++ b/include/hw/register.h
@@ -54,6 +54,11 @@  typedef struct RegisterAccessError {
  * allowing this function to modify the value before return to the client.
  */
 
+#define REG_DECODE_READ (1 << 0)
+#define REG_DECODE_WRITE (1 << 1)
+#define REG_DECODE_EXECUTE (1 << 2)
+#define REG_DECODE_RW (REG_DECODE_READ | REG_DECODE_WRITE)
+
 struct RegisterAccessInfo {
     const char *name;
     uint64_t ro;
@@ -71,6 +76,11 @@  struct RegisterAccessInfo {
     void (*post_write)(RegisterInfo *reg, uint64_t val);
 
     uint64_t (*post_read)(RegisterInfo *reg, uint64_t val);
+
+    struct {
+        hwaddr addr;
+        uint8_t flags;
+    } decode;
 };
 
 /**