mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
hw/core/register: remove the REGISTER device type
The REGISTER class (RegisterInfo struct) is currently a QOM type
inheriting from DEVICE. This class has no real purpose:
- the qdev API is not used,
- according to the comment preceding it, the object_initialize call
is here to zero-initialize the struct. However all the effective
struct attributes are then initialized explicitly.
- the object is never parented.
This commits drops the REGISTER QOM type completely, leaving the
RegisterInfo struct as a bare C struct.
The register_register_types function is left empty here because it is
reused in the next commit.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Luc Michel <luc.michel@amd.com>
Message-ID: <20251017161809.235740-2-luc.michel@amd.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
committed by
Philippe Mathieu-Daudé
parent
f74ce60226
commit
f66752961a
@@ -258,9 +258,6 @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
|
||||
int index = rae[i].addr / data_size;
|
||||
RegisterInfo *r = &ri[index];
|
||||
|
||||
/* Init the register, this will zero it. */
|
||||
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
|
||||
|
||||
/* Set the properties of the register */
|
||||
r->data = data + data_size * index;
|
||||
r->data_size = data_size;
|
||||
@@ -318,24 +315,9 @@ void register_finalize_block(RegisterInfoArray *r_array)
|
||||
g_free(r_array);
|
||||
}
|
||||
|
||||
static void register_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
/* Reason: needs to be wired up to work */
|
||||
dc->user_creatable = false;
|
||||
}
|
||||
|
||||
static const TypeInfo register_info = {
|
||||
.name = TYPE_REGISTER,
|
||||
.parent = TYPE_DEVICE,
|
||||
.class_init = register_class_init,
|
||||
.instance_size = sizeof(RegisterInfo),
|
||||
};
|
||||
|
||||
static void register_register_types(void)
|
||||
{
|
||||
type_register_static(®ister_info);
|
||||
}
|
||||
|
||||
type_init(register_register_types)
|
||||
|
||||
@@ -1868,8 +1868,6 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s,
|
||||
int index = rae[i].addr / 4;
|
||||
RegisterInfo *r = &s->reg_info[index];
|
||||
|
||||
object_initialize(r, sizeof(*r), TYPE_REGISTER);
|
||||
|
||||
*r = (RegisterInfo) {
|
||||
.data = &s->regs[index],
|
||||
.data_size = sizeof(uint32_t),
|
||||
|
||||
@@ -75,10 +75,6 @@ struct RegisterAccessInfo {
|
||||
*/
|
||||
|
||||
struct RegisterInfo {
|
||||
/* <private> */
|
||||
DeviceState parent_obj;
|
||||
|
||||
/* <public> */
|
||||
void *data;
|
||||
int data_size;
|
||||
|
||||
@@ -87,9 +83,6 @@ struct RegisterInfo {
|
||||
void *opaque;
|
||||
};
|
||||
|
||||
#define TYPE_REGISTER "qemu-register"
|
||||
DECLARE_INSTANCE_CHECKER(RegisterInfo, REGISTER,
|
||||
TYPE_REGISTER)
|
||||
|
||||
/**
|
||||
* This structure is used to group all of the individual registers which are
|
||||
|
||||
Reference in New Issue
Block a user