Skip to content

Commit cf093b0

Browse files
committed
pmu: add adb_autopoll_block() and adb_autopoll_unblock() functions
Ensure that the PMU buffer is protected from autopoll requests overwriting its contents whilst existing PMU requests are in progress. Signed-off-by: Mark Cave-Ayland <[email protected]> Tested-by: Finn Thain <[email protected]> Acked-by: Laurent Vivier <[email protected]> Message-Id: <[email protected]>
1 parent 45c9d72 commit cf093b0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hw/misc/macio/pmu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ static void pmu_update(PMUState *s)
517517
{
518518
MOS6522PMUState *mps = &s->mos6522_pmu;
519519
MOS6522State *ms = MOS6522(mps);
520+
ADBBusState *adb_bus = &s->adb_bus;
520521

521522
/* Only react to changes in reg B */
522523
if (ms->b == s->last_b) {
@@ -578,6 +579,7 @@ static void pmu_update(PMUState *s)
578579
s->cmd_rsp_pos = 0;
579580
s->cmd_state = pmu_state_cmd;
580581

582+
adb_autopoll_block(adb_bus);
581583
trace_pmu_debug_protocol_cmd(s->cmd, s->cmdlen, s->rsplen);
582584
break;
583585

@@ -636,6 +638,7 @@ static void pmu_update(PMUState *s)
636638
if (s->cmd_state == pmu_state_rsp && s->rsplen == s->cmd_rsp_pos) {
637639
trace_pmu_debug_protocol_cmd_resp_complete(ms->ier);
638640

641+
adb_autopoll_unblock(adb_bus);
639642
s->cmd_state = pmu_state_idle;
640643
}
641644
}

0 commit comments

Comments
 (0)