Last active
March 5, 2022 15:07
-
-
Save thongass000/c66b46a6620db12e13af67dbfdb4ee36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 477e4417cfe4311904bde2eab9d7707d6d265112 Mon Sep 17 00:00:00 2001 | |
From: Sami Tolvanen <samitolvanen@google.com> | |
Date: Mon, 7 May 2018 13:56:48 +0700 | |
Subject: [PATCH] soc: qcom: smp2p: fix __iomem access in SMP2P_{GET,SET}_* | |
--- | |
diff --git a/drivers/gpio/gpio-msm-smp2p-test.c b/drivers/gpio/gpio-msm-smp2p-test.c | |
index 5907513..b841953 100644 | |
--- a/drivers/gpio/gpio-msm-smp2p-test.c | |
+++ b/drivers/gpio/gpio-msm-smp2p-test.c | |
@@ -206,7 +206,7 @@ | |
strlcpy(mock->remote_item.entries[0].name, "smp2p", | |
SMP2P_MAX_ENTRY_NAME); | |
SMP2P_SET_ENT_VALID( | |
- mock->remote_item.header.valid_total_ent, 1); | |
+ &mock->remote_item.header, valid_total_ent, 1); | |
msm_smp2p_set_remote_mock_exists(true); | |
mock->tx_interrupt(); | |
@@ -306,7 +306,7 @@ | |
strlcpy(mock->remote_item.entries[0].name, "smp2p", | |
SMP2P_MAX_ENTRY_NAME); | |
SMP2P_SET_ENT_VALID( | |
- mock->remote_item.header.valid_total_ent, 1); | |
+ &mock->remote_item.header, valid_total_ent, 1); | |
msm_smp2p_set_remote_mock_exists(true); | |
mock->tx_interrupt(); | |
@@ -474,7 +474,7 @@ | |
strlcpy(mock->remote_item.entries[0].name, "smp2p", | |
SMP2P_MAX_ENTRY_NAME); | |
SMP2P_SET_ENT_VALID( | |
- mock->remote_item.header.valid_total_ent, 1); | |
+ &mock->remote_item.header, valid_total_ent, 1); | |
/* register for interrupts */ | |
smp2p_gpio_open_test_entry("smp2p", | |
diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c | |
index 1de38bf..ad519ac 100644 | |
--- a/drivers/soc/qcom/smp2p.c | |
+++ b/drivers/soc/qcom/smp2p.c | |
@@ -442,7 +442,7 @@ | |
if (!out_list[rpid].feature_ssr_ack_enabled) | |
return false; | |
- ssr_done = SMP2P_GET_RESTART_DONE(in_list[rpid].smem_edge_in->flags); | |
+ ssr_done = SMP2P_GET_RESTART_DONE(in_list[rpid].smem_edge_in, flags); | |
if (ssr_done != out_list[rpid].restart_ack) | |
return true; | |
@@ -467,7 +467,7 @@ | |
SMP2P_INFO("%s: ssr ack pid %d: %d -> %d\n", __func__, rpid, | |
out_list[rpid].restart_ack, ack); | |
out_list[rpid].restart_ack = ack; | |
- SMP2P_SET_RESTART_ACK(out_list[rpid].smem_edge_out->flags, ack); | |
+ SMP2P_SET_RESTART_ACK(out_list[rpid].smem_edge_out, flags, ack); | |
smp2p_send_interrupt(rpid); | |
} | |
@@ -495,7 +495,7 @@ | |
{ | |
uint32_t features; | |
- features = SMP2P_GET_FEATURES(out_item->smem_edge_out->feature_version); | |
+ features = SMP2P_GET_FEATURES(out_item->smem_edge_out, feature_version); | |
if (features & SMP2P_FEATURE_SSR_ACK) | |
out_item->feature_ssr_ack_enabled = true; | |
@@ -574,8 +574,8 @@ | |
} | |
smp2p_h_ptr = p_list->smem_edge_out; | |
- entries_total = SMP2P_GET_ENT_TOTAL(smp2p_h_ptr->valid_total_ent); | |
- entries_valid = SMP2P_GET_ENT_VALID(smp2p_h_ptr->valid_total_ent); | |
+ entries_total = SMP2P_GET_ENT_TOTAL(smp2p_h_ptr, valid_total_ent); | |
+ entries_valid = SMP2P_GET_ENT_VALID(smp2p_h_ptr, valid_total_ent); | |
p_list->ops_ptr->find_entry(smp2p_h_ptr, entries_total, | |
out_entry->name, &state_entry_ptr, &empty_spot); | |
@@ -604,7 +604,7 @@ | |
__func__, out_entry->name, | |
out_entry->remote_pid, | |
entries_valid, entries_total); | |
- SMP2P_SET_ENT_VALID(smp2p_h_ptr->valid_total_ent, | |
+ SMP2P_SET_ENT_VALID(smp2p_h_ptr, valid_total_ent, | |
entries_valid); | |
smp2p_send_interrupt(out_entry->remote_pid); | |
} | |
@@ -632,7 +632,7 @@ | |
return -EINVAL; | |
smp2p_h_ptr = out_list[out_entry->remote_pid].smem_edge_out; | |
- remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr->rem_loc_proc_id); | |
+ remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr, rem_loc_proc_id); | |
if (remote_pid != out_entry->remote_pid) | |
return -EINVAL; | |
@@ -666,7 +666,7 @@ | |
return -EINVAL; | |
smp2p_h_ptr = out_list[out_entry->remote_pid].smem_edge_out; | |
- remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr->rem_loc_proc_id); | |
+ remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr, rem_loc_proc_id); | |
if (remote_pid != out_entry->remote_pid) | |
return -EINVAL; | |
@@ -705,7 +705,7 @@ | |
return -EINVAL; | |
smp2p_h_ptr = out_list[out_entry->remote_pid].smem_edge_out; | |
- remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr->rem_loc_proc_id); | |
+ remote_pid = SMP2P_GET_REMOTE_PID(smp2p_h_ptr, rem_loc_proc_id); | |
if (remote_pid != out_entry->remote_pid) | |
return -EINVAL; | |
@@ -756,7 +756,7 @@ | |
in_item = &in_list[remote_pid]; | |
item_ptr = (struct smp2p_smem __iomem *)smem_item; | |
- total_entries = SMP2P_GET_ENT_TOTAL(item_ptr->valid_total_ent); | |
+ total_entries = SMP2P_GET_ENT_TOTAL(item_ptr, valid_total_ent); | |
if (total_entries > 0) { | |
in_item->safe_total_entries = total_entries; | |
in_item->item_size = size; | |
@@ -812,7 +812,7 @@ | |
{ | |
SMP2P_ERR("%s: invalid negotiation complete for v0 pid %d\n", | |
__func__, | |
- SMP2P_GET_REMOTE_PID(out_item->smem_edge_out->rem_loc_proc_id)); | |
+ SMP2P_GET_REMOTE_PID(out_item->smem_edge_out, rem_loc_proc_id)); | |
} | |
/** | |
@@ -990,16 +990,16 @@ | |
uint32_t features, uint32_t version) | |
{ | |
header_ptr->magic = SMP2P_MAGIC; | |
- SMP2P_SET_LOCAL_PID(header_ptr->rem_loc_proc_id, local_pid); | |
- SMP2P_SET_REMOTE_PID(header_ptr->rem_loc_proc_id, remote_pid); | |
- SMP2P_SET_FEATURES(header_ptr->feature_version, features); | |
- SMP2P_SET_ENT_TOTAL(header_ptr->valid_total_ent, SMP2P_MAX_ENTRY); | |
- SMP2P_SET_ENT_VALID(header_ptr->valid_total_ent, 0); | |
+ SMP2P_SET_LOCAL_PID(header_ptr, rem_loc_proc_id, local_pid); | |
+ SMP2P_SET_REMOTE_PID(header_ptr, rem_loc_proc_id, remote_pid); | |
+ SMP2P_SET_FEATURES(header_ptr, feature_version, features); | |
+ SMP2P_SET_ENT_TOTAL(header_ptr, valid_total_ent, SMP2P_MAX_ENTRY); | |
+ SMP2P_SET_ENT_VALID(header_ptr, valid_total_ent, 0); | |
header_ptr->flags = 0; | |
/* ensure that all fields are valid before version is written */ | |
wmb(); | |
- SMP2P_SET_VERSION(header_ptr->feature_version, version); | |
+ SMP2P_SET_VERSION(header_ptr, feature_version, version); | |
} | |
/** | |
@@ -1049,8 +1049,8 @@ | |
r_version = 0; | |
if (r_smem_ptr) { | |
- r_version = SMP2P_GET_VERSION(r_smem_ptr->feature_version); | |
- r_feature = SMP2P_GET_FEATURES(r_smem_ptr->feature_version); | |
+ r_version = SMP2P_GET_VERSION(r_smem_ptr, feature_version); | |
+ r_feature = SMP2P_GET_FEATURES(r_smem_ptr, feature_version); | |
} | |
if (r_version == 0) { | |
@@ -1084,7 +1084,7 @@ | |
"%s: negotiation failure pid %d: RV %d RF %x\n", | |
__func__, remote_pid, r_version, r_feature | |
); | |
- SMP2P_SET_VERSION(l_smem_ptr->feature_version, | |
+ SMP2P_SET_VERSION(l_smem_ptr, feature_version, | |
SMP2P_EDGE_STATE_FAILED); | |
smp2p_send_interrupt(remote_pid); | |
out_item->smem_edge_state = SMP2P_EDGE_STATE_FAILED; | |
diff --git a/drivers/soc/qcom/smp2p_debug.c b/drivers/soc/qcom/smp2p_debug.c | |
index 8d98d07..ffa7d4de 100644 | |
--- a/drivers/soc/qcom/smp2p_debug.c | |
+++ b/drivers/soc/qcom/smp2p_debug.c | |
@@ -89,8 +89,8 @@ | |
i += scnprintf(buf + i, max - i, | |
"%-14s LPID %d RPID %d", | |
state_text, | |
- SMP2P_GET_LOCAL_PID(item_ptr->rem_loc_proc_id), | |
- SMP2P_GET_REMOTE_PID(item_ptr->rem_loc_proc_id) | |
+ SMP2P_GET_LOCAL_PID(item_ptr, rem_loc_proc_id), | |
+ SMP2P_GET_REMOTE_PID(item_ptr, rem_loc_proc_id) | |
); | |
return i; | |
@@ -115,8 +115,8 @@ | |
i += scnprintf(buf + i, max - i, | |
"Version: %08x Features: %08x", | |
- SMP2P_GET_VERSION(item_ptr->feature_version), | |
- SMP2P_GET_FEATURES(item_ptr->feature_version) | |
+ SMP2P_GET_VERSION(item_ptr, feature_version), | |
+ SMP2P_GET_FEATURES(item_ptr, feature_version) | |
); | |
return i; | |
@@ -142,8 +142,8 @@ | |
i += scnprintf(buf + i, max - i, | |
"Entries #/Max: %d/%d Flags: %c%c", | |
- SMP2P_GET_ENT_VALID(item_ptr->valid_total_ent), | |
- SMP2P_GET_ENT_TOTAL(item_ptr->valid_total_ent), | |
+ SMP2P_GET_ENT_VALID(item_ptr, valid_total_ent), | |
+ SMP2P_GET_ENT_TOTAL(item_ptr, valid_total_ent), | |
item_ptr->flags & SMP2P_FLAGS_RESTART_ACK_MASK ? 'A' : 'a', | |
item_ptr->flags & SMP2P_FLAGS_RESTART_DONE_MASK ? 'D' : 'd' | |
); | |
@@ -230,13 +230,13 @@ | |
if (out_ptr) { | |
out_entries = (struct smp2p_entry_v1 *)((void *)out_ptr + | |
sizeof(struct smp2p_smem)); | |
- out_valid = SMP2P_GET_ENT_VALID(out_ptr->valid_total_ent); | |
+ out_valid = SMP2P_GET_ENT_VALID(out_ptr, valid_total_ent); | |
} | |
if (in_ptr) { | |
in_entries = (struct smp2p_entry_v1 *)((void *)in_ptr + | |
sizeof(struct smp2p_smem)); | |
- in_valid = SMP2P_GET_ENT_VALID(in_ptr->valid_total_ent); | |
+ in_valid = SMP2P_GET_ENT_VALID(in_ptr, valid_total_ent); | |
} | |
for (entry = 0; out_entries || in_entries; ++entry) { | |
diff --git a/drivers/soc/qcom/smp2p_private.h b/drivers/soc/qcom/smp2p_private.h | |
index 57f23e8..dae7cb5 100644 | |
--- a/drivers/soc/qcom/smp2p_private.h | |
+++ b/drivers/soc/qcom/smp2p_private.h | |
@@ -17,6 +17,7 @@ | |
#include <linux/types.h> | |
#include <linux/spinlock.h> | |
#include <linux/ipc_logging.h> | |
+#include <asm/io.h> | |
#include "smp2p_private_api.h" | |
#define SMP2P_MAX_ENTRY 16 | |
@@ -50,49 +51,63 @@ | |
| (((new_value) << (bit)) & (mask)); \ | |
} | |
-#define SMP2P_GET_LOCAL_PID(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_LOCAL_PID_MASK, SMP2P_LOCAL_PID_BIT) | |
-#define SMP2P_SET_LOCAL_PID(hdr, pid) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_LOCAL_PID_MASK, SMP2P_LOCAL_PID_BIT, pid) | |
+#define SMP2P_IOMEM_GET_BITS(hdr, val, mask, bit) \ | |
+ ({\ | |
+ const volatile void __iomem *__p = (hdr); \ | |
+ __p += offsetof(typeof(*(hdr)), val); \ | |
+ (readl(__p) & (mask)) >> (bit); \ | |
+ }) | |
+#define SMP2P_IOMEM_SET_BITS(hdr, val, mask, bit, new_value) \ | |
+ ({\ | |
+ volatile void __iomem *__p = (hdr); \ | |
+ __p += offsetof(typeof(*(hdr)), val); \ | |
+ writel((readl(__p) & ~(mask)) \ | |
+ | (((new_value) << (bit)) & (mask)), __p); \ | |
+ }) | |
-#define SMP2P_GET_REMOTE_PID(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_REMOTE_PID_MASK, SMP2P_REMOTE_PID_BIT) | |
-#define SMP2P_SET_REMOTE_PID(hdr, pid) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_REMOTE_PID_MASK, SMP2P_REMOTE_PID_BIT, pid) | |
+#define SMP2P_GET_LOCAL_PID(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_LOCAL_PID_MASK, SMP2P_LOCAL_PID_BIT) | |
+#define SMP2P_SET_LOCAL_PID(hdr, val, pid) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_LOCAL_PID_MASK, SMP2P_LOCAL_PID_BIT, pid) | |
-#define SMP2P_GET_VERSION(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_VERSION_MASK, SMP2P_VERSION_BIT) | |
-#define SMP2P_SET_VERSION(hdr, version) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_VERSION_MASK, SMP2P_VERSION_BIT, version) | |
+#define SMP2P_GET_REMOTE_PID(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_REMOTE_PID_MASK, SMP2P_REMOTE_PID_BIT) | |
+#define SMP2P_SET_REMOTE_PID(hdr, val, pid) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_REMOTE_PID_MASK, SMP2P_REMOTE_PID_BIT, pid) | |
-#define SMP2P_GET_FEATURES(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_FEATURE_MASK, SMP2P_FEATURE_BIT) | |
-#define SMP2P_SET_FEATURES(hdr, features) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_FEATURE_MASK, SMP2P_FEATURE_BIT, features) | |
+#define SMP2P_GET_VERSION(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_VERSION_MASK, SMP2P_VERSION_BIT) | |
+#define SMP2P_SET_VERSION(hdr, val, version) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_VERSION_MASK, SMP2P_VERSION_BIT, version) | |
-#define SMP2P_GET_ENT_TOTAL(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_ENT_TOTAL_MASK, SMP2P_ENT_TOTAL_BIT) | |
-#define SMP2P_SET_ENT_TOTAL(hdr, entries) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_ENT_TOTAL_MASK, SMP2P_ENT_TOTAL_BIT, entries) | |
+#define SMP2P_GET_FEATURES(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_FEATURE_MASK, SMP2P_FEATURE_BIT) | |
+#define SMP2P_SET_FEATURES(hdr, val, features) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_FEATURE_MASK, SMP2P_FEATURE_BIT, features) | |
-#define SMP2P_GET_ENT_VALID(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_ENT_VALID_MASK, SMP2P_ENT_VALID_BIT) | |
-#define SMP2P_SET_ENT_VALID(hdr, entries) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_ENT_VALID_MASK, SMP2P_ENT_VALID_BIT,\ | |
+#define SMP2P_GET_ENT_TOTAL(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_ENT_TOTAL_MASK, SMP2P_ENT_TOTAL_BIT) | |
+#define SMP2P_SET_ENT_TOTAL(hdr, val, entries) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_ENT_TOTAL_MASK, SMP2P_ENT_TOTAL_BIT, entries) | |
+ | |
+#define SMP2P_GET_ENT_VALID(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_ENT_VALID_MASK, SMP2P_ENT_VALID_BIT) | |
+#define SMP2P_SET_ENT_VALID(hdr, val, entries) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_ENT_VALID_MASK, SMP2P_ENT_VALID_BIT,\ | |
entries) | |
-#define SMP2P_GET_RESTART_DONE(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_FLAGS_RESTART_DONE_MASK, \ | |
+#define SMP2P_GET_RESTART_DONE(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_FLAGS_RESTART_DONE_MASK, \ | |
SMP2P_FLAGS_RESTART_DONE_BIT) | |
-#define SMP2P_SET_RESTART_DONE(hdr, value) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_FLAGS_RESTART_DONE_MASK, \ | |
+#define SMP2P_SET_RESTART_DONE(hdr, val, value) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_FLAGS_RESTART_DONE_MASK, \ | |
SMP2P_FLAGS_RESTART_DONE_BIT, value) | |
-#define SMP2P_GET_RESTART_ACK(hdr) \ | |
- SMP2P_GET_BITS(hdr, SMP2P_FLAGS_RESTART_ACK_MASK, \ | |
+#define SMP2P_GET_RESTART_ACK(hdr, val) \ | |
+ SMP2P_IOMEM_GET_BITS(hdr, val, SMP2P_FLAGS_RESTART_ACK_MASK, \ | |
SMP2P_FLAGS_RESTART_ACK_BIT) | |
-#define SMP2P_SET_RESTART_ACK(hdr, value) \ | |
- SMP2P_SET_BITS(hdr, SMP2P_FLAGS_RESTART_ACK_MASK, \ | |
+#define SMP2P_SET_RESTART_ACK(hdr, val, value) \ | |
+ SMP2P_IOMEM_SET_BITS(hdr, val, SMP2P_FLAGS_RESTART_ACK_MASK, \ | |
SMP2P_FLAGS_RESTART_ACK_BIT, value) | |
/* Loopback Command Macros */ | |
diff --git a/drivers/soc/qcom/smp2p_test.c b/drivers/soc/qcom/smp2p_test.c | |
index 397a547..569ff85 100644 | |
--- a/drivers/soc/qcom/smp2p_test.c | |
+++ b/drivers/soc/qcom/smp2p_test.c | |
@@ -66,19 +66,19 @@ | |
/* simulate response from remote side */ | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY); | |
+ &rmp->remote_item.header, valid_total_ent, SMP2P_MAX_ENTRY); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 0); | |
+ &rmp->remote_item.header, valid_total_ent, 0); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
rmp->tx_interrupt(); | |
@@ -149,20 +149,20 @@ | |
sizeof(struct smp2p_smem_item)); | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, | |
+ &rmp->remote_item.header, valid_total_ent, | |
SMP2P_MAX_ENTRY); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 0); | |
+ &rmp->remote_item.header, valid_total_ent, 0); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
@@ -240,19 +240,19 @@ | |
sizeof(struct smp2p_smem_item)); | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY); | |
+ &rmp->remote_item.header, valid_total_ent, SMP2P_MAX_ENTRY); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 0); | |
+ &rmp->remote_item.header, valid_total_ent, 0); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(false); | |
@@ -277,7 +277,7 @@ | |
UT_ASSERT_PTR(outbound_item, !=, NULL); | |
UT_ASSERT_INT(negotiation_state, ==, SMP2P_EDGE_STATE_OPENING); | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_ENT_VALID(outbound_item->valid_total_ent)); | |
+ SMP2P_GET_ENT_VALID(outbound_item, valid_total_ent)); | |
/* verify that read/write don't work yet */ | |
rmp->rx_interrupt_count = 0; | |
@@ -358,19 +358,19 @@ | |
sizeof(struct smp2p_smem_item)); | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY); | |
+ &rmp->remote_item.header, valid_total_ent, SMP2P_MAX_ENTRY); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 1); | |
+ &rmp->remote_item.header, valid_total_ent, 1); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
@@ -781,19 +781,19 @@ | |
sizeof(struct smp2p_smem_item)); | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, SMP2P_MAX_ENTRY); | |
+ &rmp->remote_item.header, valid_total_ent, SMP2P_MAX_ENTRY); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 0); | |
+ &rmp->remote_item.header, valid_total_ent, 0); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
@@ -879,19 +879,19 @@ | |
sizeof(struct smp2p_smem_item)); | |
rmp->remote_item.header.magic = SMP2P_MAGIC; | |
SMP2P_SET_LOCAL_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
SMP2P_SET_REMOTE_PID( | |
- rmp->remote_item.header.rem_loc_proc_id, | |
+ &rmp->remote_item.header, rem_loc_proc_id, | |
SMP2P_APPS_PROC); | |
SMP2P_SET_VERSION( | |
- rmp->remote_item.header.feature_version, 1); | |
+ &rmp->remote_item.header, feature_version, 1); | |
SMP2P_SET_FEATURES( | |
- rmp->remote_item.header.feature_version, 0); | |
+ &rmp->remote_item.header, feature_version, 0); | |
SMP2P_SET_ENT_TOTAL( | |
- rmp->remote_item.header.valid_total_ent, 1); | |
+ &rmp->remote_item.header, valid_total_ent, 1); | |
SMP2P_SET_ENT_VALID( | |
- rmp->remote_item.header.valid_total_ent, 0); | |
+ &rmp->remote_item.header, valid_total_ent, 0); | |
rmp->remote_item.header.flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
@@ -980,13 +980,13 @@ | |
rmp->rx_interrupt_count = 0; | |
memset(&rmp->remote_item, 0, sizeof(struct smp2p_smem_item)); | |
rhdr->magic = SMP2P_MAGIC; | |
- SMP2P_SET_LOCAL_PID(rhdr->rem_loc_proc_id, | |
+ SMP2P_SET_LOCAL_PID(rhdr, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
- SMP2P_SET_REMOTE_PID(rhdr->rem_loc_proc_id, SMP2P_APPS_PROC); | |
- SMP2P_SET_VERSION(rhdr->feature_version, 1); | |
- SMP2P_SET_FEATURES(rhdr->feature_version, 0); | |
- SMP2P_SET_ENT_TOTAL(rhdr->valid_total_ent, SMP2P_MAX_ENTRY); | |
- SMP2P_SET_ENT_VALID(rhdr->valid_total_ent, 0); | |
+ SMP2P_SET_REMOTE_PID(rhdr, rem_loc_proc_id, SMP2P_APPS_PROC); | |
+ SMP2P_SET_VERSION(rhdr, feature_version, 1); | |
+ SMP2P_SET_FEATURES(rhdr, feature_version, 0); | |
+ SMP2P_SET_ENT_TOTAL(rhdr, valid_total_ent, SMP2P_MAX_ENTRY); | |
+ SMP2P_SET_ENT_VALID(rhdr, valid_total_ent, 0); | |
rhdr->flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
rmp->tx_interrupt(); | |
@@ -1000,10 +1000,10 @@ | |
/* verify no response to ack feature */ | |
rmp->rx_interrupt_count = 0; | |
- SMP2P_SET_RESTART_DONE(rhdr->flags, 1); | |
+ SMP2P_SET_RESTART_DONE(rhdr, flags, 1); | |
rmp->tx_interrupt(); | |
- UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags)); | |
- UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr, flags)); | |
+ UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 0); | |
/* initialize v1 with SMP2P_FEATURE_SSR_ACK enabled */ | |
@@ -1016,14 +1016,14 @@ | |
rmp->rx_interrupt_count = 0; | |
memset(&rmp->remote_item, 0, sizeof(struct smp2p_smem_item)); | |
rhdr->magic = SMP2P_MAGIC; | |
- SMP2P_SET_LOCAL_PID(rhdr->rem_loc_proc_id, | |
+ SMP2P_SET_LOCAL_PID(rhdr, rem_loc_proc_id, | |
SMP2P_REMOTE_MOCK_PROC); | |
- SMP2P_SET_REMOTE_PID(rhdr->rem_loc_proc_id, SMP2P_APPS_PROC); | |
- SMP2P_SET_VERSION(rhdr->feature_version, 1); | |
- SMP2P_SET_FEATURES(rhdr->feature_version, | |
+ SMP2P_SET_REMOTE_PID(rhdr, rem_loc_proc_id, SMP2P_APPS_PROC); | |
+ SMP2P_SET_VERSION(rhdr, feature_version, 1); | |
+ SMP2P_SET_FEATURES(rhdr, feature_version, | |
SMP2P_FEATURE_SSR_ACK); | |
- SMP2P_SET_ENT_TOTAL(rhdr->valid_total_ent, SMP2P_MAX_ENTRY); | |
- SMP2P_SET_ENT_VALID(rhdr->valid_total_ent, 0); | |
+ SMP2P_SET_ENT_TOTAL(rhdr, valid_total_ent, SMP2P_MAX_ENTRY); | |
+ SMP2P_SET_ENT_VALID(rhdr, valid_total_ent, 0); | |
rmp->rx_interrupt_count = 0; | |
rhdr->flags = 0x0; | |
msm_smp2p_set_remote_mock_exists(true); | |
@@ -1038,17 +1038,17 @@ | |
/* verify response to ack feature */ | |
rmp->rx_interrupt_count = 0; | |
- SMP2P_SET_RESTART_DONE(rhdr->flags, 1); | |
+ SMP2P_SET_RESTART_DONE(rhdr, flags, 1); | |
rmp->tx_interrupt(); | |
- UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags)); | |
- UT_ASSERT_INT(1, ==, SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr, flags)); | |
+ UT_ASSERT_INT(1, ==, SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1); | |
rmp->rx_interrupt_count = 0; | |
- SMP2P_SET_RESTART_DONE(rhdr->flags, 0); | |
+ SMP2P_SET_RESTART_DONE(rhdr, flags, 0); | |
rmp->tx_interrupt(); | |
- UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr->flags)); | |
- UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_DONE(lhdr, flags)); | |
+ UT_ASSERT_INT(0, ==, SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
UT_ASSERT_INT(rmp->rx_interrupt_count, ==, 1); | |
seq_puts(s, "\tOK\n"); | |
@@ -1117,15 +1117,15 @@ | |
UT_ASSERT_PTR(NULL, !=, rhdr); | |
/* get initial state of SSR flags */ | |
- if (SMP2P_GET_FEATURES(rhdr->feature_version) | |
+ if (SMP2P_GET_FEATURES(rhdr, feature_version) | |
& SMP2P_FEATURE_SSR_ACK) | |
ssr_ack_enabled = true; | |
else | |
ssr_ack_enabled = false; | |
- ssr_done_start = SMP2P_GET_RESTART_DONE(rhdr->flags); | |
+ ssr_done_start = SMP2P_GET_RESTART_DONE(rhdr, flags); | |
UT_ASSERT_INT(ssr_done_start, ==, | |
- SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
/* trigger restart */ | |
name_index = 0; | |
@@ -1181,22 +1181,22 @@ | |
if (ssr_ack_enabled) { | |
ssr_done_start ^= 1; | |
UT_ASSERT_INT(ssr_done_start, ==, | |
- SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
UT_ASSERT_INT(ssr_done_start, ==, | |
- SMP2P_GET_RESTART_DONE(rhdr->flags)); | |
+ SMP2P_GET_RESTART_DONE(rhdr, flags)); | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_RESTART_DONE(lhdr->flags)); | |
+ SMP2P_GET_RESTART_DONE(lhdr, flags)); | |
seq_puts(s, "\tSSR ACK Enabled and Toggled\n"); | |
} else { | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_RESTART_DONE(lhdr->flags)); | |
+ SMP2P_GET_RESTART_DONE(lhdr, flags)); | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_RESTART_ACK(lhdr->flags)); | |
+ SMP2P_GET_RESTART_ACK(lhdr, flags)); | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_RESTART_DONE(rhdr->flags)); | |
+ SMP2P_GET_RESTART_DONE(rhdr, flags)); | |
UT_ASSERT_INT(0, ==, | |
- SMP2P_GET_RESTART_ACK(rhdr->flags)); | |
+ SMP2P_GET_RESTART_ACK(rhdr, flags)); | |
seq_puts(s, "\tSSR ACK Disabled\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment