[PATCH net-next 01/11] net: ipa: define IPA_MEM_END_MARKER
From: Alex Elder
Date: Wed Jun 09 2021 - 18:36:23 EST
Define a new pseudo memory region identifer that specifies the
offset at the end of IPA resident memory. Use it instead of
IPA_MEM_UC_EVENT_RING in places where the size of that region was
defined to be 0.
The size of the IPA_MEM_END_MARKER pseudo region must be zero.
Signed-off-by: Alex Elder <elder@xxxxxxxxxx>
---
drivers/net/ipa/ipa_data-v4.11.c | 2 +-
drivers/net/ipa/ipa_data-v4.2.c | 2 +-
drivers/net/ipa/ipa_mem.c | 2 ++
drivers/net/ipa/ipa_mem.h | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ipa/ipa_data-v4.11.c b/drivers/net/ipa/ipa_data-v4.11.c
index 05806ceae8b54..e7bdb8b4400e7 100644
--- a/drivers/net/ipa/ipa_data-v4.11.c
+++ b/drivers/net/ipa/ipa_data-v4.11.c
@@ -325,7 +325,7 @@ static const struct ipa_mem ipa_mem_local_data[] = {
.size = 0x100c,
.canary_count = 2,
},
- [IPA_MEM_UC_EVENT_RING] = {
+ [IPA_MEM_END_MARKER] = {
.offset = 0x3000,
.size = 0x0000,
.canary_count = 1,
diff --git a/drivers/net/ipa/ipa_data-v4.2.c b/drivers/net/ipa/ipa_data-v4.2.c
index 8744f19c64011..95f75dbc3c3bc 100644
--- a/drivers/net/ipa/ipa_data-v4.2.c
+++ b/drivers/net/ipa/ipa_data-v4.2.c
@@ -304,7 +304,7 @@ static const struct ipa_mem ipa_mem_local_data[] = {
.size = 0x140c,
.canary_count = 0,
},
- [IPA_MEM_UC_EVENT_RING] = {
+ [IPA_MEM_END_MARKER] = {
.offset = 0x2000,
.size = 0,
.canary_count = 1,
diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
index 1624125e7459f..e3c43cf6e4412 100644
--- a/drivers/net/ipa/ipa_mem.c
+++ b/drivers/net/ipa/ipa_mem.c
@@ -120,6 +120,8 @@ static bool ipa_mem_valid(struct ipa *ipa, enum ipa_mem_id mem_id)
else if (mem->offset + mem->size > ipa->mem_size)
dev_err(dev, "region %u ends beyond memory limit (0x%08x)\n",
mem_id, ipa->mem_size);
+ else if (mem_id == IPA_MEM_END_MARKER && mem->size)
+ dev_err(dev, "non-zero end marker region size\n");
else
return true;
diff --git a/drivers/net/ipa/ipa_mem.h b/drivers/net/ipa/ipa_mem.h
index a422aec69e5da..5a4f865a45afa 100644
--- a/drivers/net/ipa/ipa_mem.h
+++ b/drivers/net/ipa/ipa_mem.h
@@ -70,6 +70,7 @@ enum ipa_mem_id {
IPA_MEM_STATS_DROP, /* 0 canaries (IPA v4.0 and above) */
IPA_MEM_MODEM, /* 0/2 canaries */
IPA_MEM_UC_EVENT_RING, /* 1 canary */
+ IPA_MEM_END_MARKER, /* 1 canary (not a real region) */
IPA_MEM_COUNT, /* Number of regions (not an index) */
};
--
2.27.0