mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
hw/core/register: Add more 64-bit utilities
We already have some utilities to handle 64-bit wide registers, so this just adds some more for: - Initializing 64-bit registers - Extracting and depositing to an array of 64-bit registers Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 1626805903-162860-2-git-send-email-joe.komlodi@xilinx.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
4dc06bb816
commit
4d63ef20cf
3 changed files with 28 additions and 0 deletions
|
@ -300,6 +300,18 @@ RegisterInfoArray *register_init_block32(DeviceState *owner,
|
|||
data, ops, debug_enabled, memory_size, 32);
|
||||
}
|
||||
|
||||
RegisterInfoArray *register_init_block64(DeviceState *owner,
|
||||
const RegisterAccessInfo *rae,
|
||||
int num, RegisterInfo *ri,
|
||||
uint64_t *data,
|
||||
const MemoryRegionOps *ops,
|
||||
bool debug_enabled,
|
||||
uint64_t memory_size)
|
||||
{
|
||||
return register_init_block(owner, rae, num, ri, (void *)
|
||||
data, ops, debug_enabled, memory_size, 64);
|
||||
}
|
||||
|
||||
void register_finalize_block(RegisterInfoArray *r_array)
|
||||
{
|
||||
object_unparent(OBJECT(&r_array->mem));
|
||||
|
|
|
@ -204,6 +204,14 @@ RegisterInfoArray *register_init_block32(DeviceState *owner,
|
|||
bool debug_enabled,
|
||||
uint64_t memory_size);
|
||||
|
||||
RegisterInfoArray *register_init_block64(DeviceState *owner,
|
||||
const RegisterAccessInfo *rae,
|
||||
int num, RegisterInfo *ri,
|
||||
uint64_t *data,
|
||||
const MemoryRegionOps *ops,
|
||||
bool debug_enabled,
|
||||
uint64_t memory_size);
|
||||
|
||||
/**
|
||||
* This function should be called to cleanup the registers that were initialized
|
||||
* when calling register_init_block32(). This function should only be called
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
enum { A_ ## reg = (addr) }; \
|
||||
enum { R_ ## reg = (addr) / 2 };
|
||||
|
||||
#define REG64(reg, addr) \
|
||||
enum { A_ ## reg = (addr) }; \
|
||||
enum { R_ ## reg = (addr) / 8 };
|
||||
|
||||
/* Define SHIFT, LENGTH and MASK constants for a field within a register */
|
||||
|
||||
/* This macro will define R_FOO_BAR_MASK, R_FOO_BAR_SHIFT and R_FOO_BAR_LENGTH
|
||||
|
@ -58,6 +62,8 @@
|
|||
/* Extract a field from an array of registers */
|
||||
#define ARRAY_FIELD_EX32(regs, reg, field) \
|
||||
FIELD_EX32((regs)[R_ ## reg], reg, field)
|
||||
#define ARRAY_FIELD_EX64(regs, reg, field) \
|
||||
FIELD_EX64((regs)[R_ ## reg], reg, field)
|
||||
|
||||
/* Deposit a register field.
|
||||
* Assigning values larger then the target field will result in
|
||||
|
@ -99,5 +105,7 @@
|
|||
/* Deposit a field to array of registers. */
|
||||
#define ARRAY_FIELD_DP32(regs, reg, field, val) \
|
||||
(regs)[R_ ## reg] = FIELD_DP32((regs)[R_ ## reg], reg, field, val);
|
||||
#define ARRAY_FIELD_DP64(regs, reg, field, val) \
|
||||
(regs)[R_ ## reg] = FIELD_DP64((regs)[R_ ## reg], reg, field, val);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue