Skip to content

Conversation

@luismarques
Copy link

No description provided.

};

#define OT_EG_DEBUG_LC_CTRL_ADDR 0x0u
#define OT_EG_DEBUG_LC_CTRL_SIZE 0x200u

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this size defined? I can't find a source on earlgrey_1.0.0 but on master this seems like it should be 0x1000 instead?

Copy link
Author

@luismarques luismarques Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the bus is private, I just used the maximum allowed size, given the abits=7 (2^7 * 4 == 0x200, with the 4 being for the 1:4 mapping adjustment). That way we can keep the actual size needed known only inside the ot_lc_ctrl.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth adding a comment to keep track of this, and/or use a defined constant for the bit width (7) and a macro based on it to compute the actual range?

Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems mostly ok to me

};

#define OT_EG_DEBUG_LC_CTRL_ADDR 0x0u
#define OT_EG_DEBUG_LC_CTRL_SIZE 0x200u

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth adding a comment to keep track of this, and/or use a defined constant for the bit width (7) and a macro based on it to compute the actual range?


#define OT_EG_DEBUG_LC_CTRL_ADDR 0x0u
#define OT_EG_DEBUG_LC_CTRL_SIZE 0x200u
#define OT_EG_DEBUG_LC_CTRL_DMI_ADDR (OT_EG_DEBUG_LC_CTRL_ADDR / 4)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit pick: either 4u or sizeof(uint32_t)

OT_EG_SOC_DEVLINK("tl_dev", LC_CTRL)
),
.prop = IBEXDEVICEPROPDEFS(
IBEX_DEV_UINT_PROP("dmi_addr", OT_EG_DEBUG_LC_CTRL_DMI_ADDR),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit pick: maybe OT_EG_LC_CTRL_DMI_ADDR to match OT_EG_LC_CTRL_MEMORY_REGION? Dmi already stands for DEBUG.

OT_EG_LC_CTRL_MEMORY_REGION));
Object *oas;
AddressSpace *as = g_new0(AddressSpace, 1u);
address_space_init(as, lc_ctrl_mr, "lc-ctrl.as");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment about the role of this new AS?

AddressSpace *as = g_new0(AddressSpace, 1u);
address_space_init(as, lc_ctrl_mr, "lc-ctrl.as");
oas = object_new(TYPE_OT_ADDRESS_SPACE);
object_property_add_child(OBJECT(dev), "ot-lc-ctrl-dmi-as", oas);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use object_property_add_child(OBJECT(dev), as->name, oas);
for the property name. It is probably easier when debugging to have the AS refered by its name.

ibex_map_devices(s->devices, mrs, ot_eg_soc_devices,
ARRAY_SIZE(ot_eg_soc_devices));
MemoryRegion *lc_ctrl_mr = g_new0(MemoryRegion, 1u);
memory_region_init(lc_ctrl_mr, OBJECT(dev), "lc-ctrl-dmi.xbar",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try to use the same radix for all related naming, i.e. "lc-ctrl.xbar", or better:

TYPE_OT_LC_CTRL ".xbar"
TYPE_OT_LC_CTRL ".as"
// see note in another comment about as->name
IBEX_DEV_STRING_PROP("tl_as_name", TYPE_OT_LC_CTRL ".as")

IBEX_DEV_UINT_PROP("dmi_addr", OT_EG_DEBUG_LC_CTRL_DMI_ADDR),
IBEX_DEV_UINT_PROP("dmi_size", OT_EG_DEBUG_LC_CTRL_DMI_SIZE),
IBEX_DEV_UINT_PROP("tl_addr", OT_EG_DEBUG_LC_CTRL_ADDR),
IBEX_DEV_STRING_PROP("tl_as_name", "ot-lc-ctrl-dmi-as")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this name "ot-lc-ctrl-dmi-as" is repeated as a hardcoded string, maybe extract it out to a:

#define LC_CTRL_ADDR_SPACE "ot-lc-ctrl-dmi-as"

or equivalent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants