From cd04a5f1aadc8e2ec4e787f5ba4cc8c38a579314 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Tue, 18 Nov 2014 23:27:26 +0100 Subject: hwstub/qeditor: add support for atomic read/writes The current code assumed that READ/WRITE would produce atomic read/writes for 8/16/32-bit words, which in turned put assumption on the memcpy function. Since some memcpy implementation do not always guarantee such strong assumption, introduce two new operation READ/WRITE_ATOMIC which provide the necessary tools to do correct read and write to register in a single memory access. Change-Id: I37451bd5057bb0dcaf5a800d8aef8791c792a090 --- utils/hwstub/hwstub_protocol.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'utils/hwstub/hwstub_protocol.h') diff --git a/utils/hwstub/hwstub_protocol.h b/utils/hwstub/hwstub_protocol.h index 33081d3ca2..1fe982323d 100644 --- a/utils/hwstub/hwstub_protocol.h +++ b/utils/hwstub/hwstub_protocol.h @@ -26,7 +26,7 @@ */ #define HWSTUB_VERSION_MAJOR 4 -#define HWSTUB_VERSION_MINOR 0 +#define HWSTUB_VERSION_MINOR 1 #define HWSTUB_VERSION__(maj, min) #maj"."#min #define HWSTUB_VERSION_(maj, min) HWSTUB_VERSION__(maj, min) @@ -140,6 +140,8 @@ struct hwstub_device_desc_t #define HWSTUB_READ2 0x42 #define HWSTUB_WRITE 0x43 #define HWSTUB_EXEC 0x44 +#define HWSTUB_READ2_ATOMIC 0x45 +#define HWSTUB_WRITE_ATOMIC 0x46 /** * HWSTUB_GET_LOG: @@ -147,11 +149,14 @@ struct hwstub_device_desc_t */ /** - * HWSTUB_READ and HWSTUB_READ2: + * HWSTUB_READ and HWSTUB_READ2(_ATOMIC): * Read a range of memory. The request works in two steps: first the host * sends HWSTUB_READ with the parameters (address, length) and then * a HWSTUB_READ2 to retrieve the buffer. Both requests must use the same * ID in wValue, otherwise the second request will be STALLed. + * HWSTUB_READ2_ATOMIC behaves the same as HWSTUB_READ2 except that the read + * is guaranteed to be atomic (ie performed as a single memory access) and + * will be STALLed if atomicity can not be ensured. */ struct hwstub_read_req_t @@ -163,6 +168,7 @@ struct hwstub_read_req_t * HWSTUB_WRITE * Write a range of memory. The payload starts with the following header, everything * which follows is data. + * HWSTUB_WRITE_ATOMIC behaves the same except it is atomic. See HWSTUB_READ2_ATOMIC. */ struct hwstub_write_req_t { -- cgit v1.2.3