Change set_haltgroup() to more general set_group()
Change-Id: Ib91a252ac63604e54b756f70c549ccd47241fd10 Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
parent
b6dddfacc0
commit
e191bccc73
|
@ -1503,15 +1503,20 @@ static void deinit_target(struct target *target)
|
||||||
info->version_specific = NULL;
|
info->version_specific = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_haltgroup(struct target *target, bool *supported)
|
typedef enum {
|
||||||
|
HALTGROUP,
|
||||||
|
RESUMEGROUP
|
||||||
|
} grouptype_t;
|
||||||
|
static int set_group(struct target *target, bool *supported, unsigned group, grouptype_t grouptype)
|
||||||
{
|
{
|
||||||
uint32_t write = set_field(DM_DMCS2_HGWRITE, DM_DMCS2_GROUP, target->smp);
|
uint32_t write = set_field(DM_DMCS2_HGWRITE, DM_DMCS2_GROUP, group);
|
||||||
|
write = set_field(write, DM_DMCS2_GROUPTYPE, 1);
|
||||||
if (dmi_write(target, DM_DMCS2, write) != ERROR_OK)
|
if (dmi_write(target, DM_DMCS2, write) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
uint32_t read;
|
uint32_t read;
|
||||||
if (dmi_read(target, &read, DM_DMCS2) != ERROR_OK)
|
if (dmi_read(target, &read, DM_DMCS2) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
*supported = get_field(read, DM_DMCS2_GROUP) == (unsigned)target->smp;
|
*supported = get_field(read, DM_DMCS2_GROUP) == group;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,7 +1759,7 @@ static int examine(struct target *target)
|
||||||
|
|
||||||
if (target->smp) {
|
if (target->smp) {
|
||||||
bool haltgroup_supported;
|
bool haltgroup_supported;
|
||||||
if (set_haltgroup(target, &haltgroup_supported) != ERROR_OK)
|
if (set_group(target, &haltgroup_supported, target->smp, HALTGROUP) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
if (haltgroup_supported)
|
if (haltgroup_supported)
|
||||||
LOG_INFO("Core %d made part of halt group %d.", target->coreid,
|
LOG_INFO("Core %d made part of halt group %d.", target->coreid,
|
||||||
|
|
Loading…
Reference in New Issue