On 12.06.25 08:58, Cédric Le Goater wrote:
LGTM,
Jamin, Steven, Troy ?
On 12.06.25 01:43, Tan Siewert wrote:
- if (reg > PROT_KEY && !s->regs[PROT_KEY]) {
+ if ((reg != AST2600_PROT_KEY && reg != AST2600_PROT_KEY2) && !
unlocked) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: SCU is locked!\n",
__func__);
}
I just noticed that this never return when the SCU is locked, meaning
you can still write to the SCU registers even though it is locked. I'll
send a v2 in a few minutes that addresses this issue too.
The AST2500 SCU handles this correctly here.
Sorry for that!
Cheers,
Tan
@@ -738,7 +740,18 @@ static void aspeed_ast2600_scu_write(void
*opaque, hwaddr offset,
switch (reg) {
case AST2600_PROT_KEY:
- s->regs[reg] = (data == ASPEED_SCU_PROT_KEY) ? 1 : 0;
+ case AST2600_PROT_KEY2:
+ /*
+ * Writing a value other than the protection key will lock
+ * both protection registers, but unlocking must be done
+ * to each protection register individually.
+ */
+ if (data != ASPEED_SCU_PROT_KEY) {
+ s->regs[AST2600_PROT_KEY] = 0;
+ s->regs[AST2600_PROT_KEY2] = 0;
+ } else {
+ s->regs[reg] = (data == ASPEED_SCU_PROT_KEY) ? 1 : 0;
+ }
return;
case AST2600_HW_STRAP1:
case AST2600_HW_STRAP2: