[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/22] cuda: add adb_autopoll_block() and adb_autopoll_unblock
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 16/22] cuda: add adb_autopoll_block() and adb_autopoll_unblock() functions |
Date: |
Tue, 23 Jun 2020 21:49:30 +0100 |
Ensure that the CUDA buffer is protected from autopoll requests overwriting
its contents whilst existing CUDA requests are in progress.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Finn Thain <fthain@telegraphics.com.au>
---
hw/misc/macio/cuda.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index b7071e89d5..5bbc7770fa 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -116,6 +116,7 @@ static void cuda_update(CUDAState *s)
{
MOS6522CUDAState *mcs = &s->mos6522_cuda;
MOS6522State *ms = MOS6522(mcs);
+ ADBBusState *adb_bus = &s->adb_bus;
int packet_received, len;
packet_received = 0;
@@ -126,6 +127,9 @@ static void cuda_update(CUDAState *s)
/* data output */
if ((ms->b & (TACK | TIP)) != (s->last_b & (TACK | TIP))) {
if (s->data_out_index < sizeof(s->data_out)) {
+ if (s->data_out_index == 0) {
+ adb_autopoll_block(adb_bus);
+ }
trace_cuda_data_send(ms->sr);
s->data_out[s->data_out_index++] = ms->sr;
cuda_delay_set_sr_int(s);
@@ -140,6 +144,7 @@ static void cuda_update(CUDAState *s)
/* indicate end of transfer */
if (s->data_in_index >= s->data_in_size) {
ms->b = (ms->b | TREQ);
+ adb_autopoll_unblock(adb_bus);
}
cuda_delay_set_sr_int(s);
}
--
2.20.1
- [PATCH v2 06/22] adb: introduce realize/unrealize and VMStateDescription for ADB bus, (continued)
- [PATCH v2 06/22] adb: introduce realize/unrealize and VMStateDescription for ADB bus, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 07/22] adb: create autopoll variables directly within ADBBusState, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 08/22] cuda: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 09/22] pmu: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 10/22] mac_via: convert to use ADBBusState internal autopoll variables, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 11/22] adb: introduce new ADBDeviceHasData method to ADBDeviceClass, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 12/22] adb: keep track of devices with pending data, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 13/22] adb: add status field for holding information about the last ADB request, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 14/22] adb: use adb_request() only for explicit requests, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 15/22] adb: add autopoll_blocked variable to block autopoll, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 16/22] cuda: add adb_autopoll_block() and adb_autopoll_unblock() functions,
Mark Cave-Ayland <=
- [PATCH v2 17/22] pmu: add adb_autopoll_block() and adb_autopoll_unblock() functions, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 18/22] mac_via: move VIA1 portB write logic into mos6522_q800_via1_write(), Mark Cave-Ayland, 2020/06/23
- [PATCH v2 19/22] mac_via: rework ADB state machine to be compatible with both MacOS and Linux, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 20/22] adb: only call autopoll callbacks when autopoll is not blocked, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 21/22] adb: use adb_device prefix for ADB device trace events, Mark Cave-Ayland, 2020/06/23
- [PATCH v2 22/22] adb: add ADB bus trace events, Mark Cave-Ayland, 2020/06/23
- Re: [PATCH v2 00/22] ADB: fix autopoll issues and rework mac_via state machine, Laurent Vivier, 2020/06/26