msm: smd: add support for RPM based edges
RPM SMD edges only support word size accesses, so modify internal SMD
structures to reflect that constraint. Also abstract away the differences
to preserve common code so that SMD edge processing code works on all edges.
Change-Id: Ica3e751ea660965ff777d40084ca2b66dcc7302a
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 764102d..5dce1ac 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -248,8 +248,9 @@
}
static int dump_ch(char *buf, int max, int n,
- struct smd_half_channel *s,
- struct smd_half_channel *r,
+ void *half_ch_s,
+ void *half_ch_r,
+ struct smd_half_channel_access *half_ch_funcs,
unsigned size)
{
return scnprintf(
@@ -257,24 +258,28 @@
"ch%02d:"
" %8s(%04d/%04d) %c%c%c%c%c%c%c%c <->"
" %8s(%04d/%04d) %c%c%c%c%c%c%c%c : %5x\n", n,
- chstate(s->state), s->tail, s->head,
- s->fDSR ? 'D' : 'd',
- s->fCTS ? 'C' : 'c',
- s->fCD ? 'C' : 'c',
- s->fRI ? 'I' : 'i',
- s->fHEAD ? 'W' : 'w',
- s->fTAIL ? 'R' : 'r',
- s->fSTATE ? 'S' : 's',
- s->fBLOCKREADINTR ? 'B' : 'b',
- chstate(r->state), r->tail, r->head,
- r->fDSR ? 'D' : 'd',
- r->fCTS ? 'R' : 'r',
- r->fCD ? 'C' : 'c',
- r->fRI ? 'I' : 'i',
- r->fHEAD ? 'W' : 'w',
- r->fTAIL ? 'R' : 'r',
- r->fSTATE ? 'S' : 's',
- r->fBLOCKREADINTR ? 'B' : 'b',
+ chstate(half_ch_funcs->get_state(half_ch_s)),
+ half_ch_funcs->get_tail(half_ch_s),
+ half_ch_funcs->get_head(half_ch_s),
+ half_ch_funcs->get_fDSR(half_ch_s) ? 'D' : 'd',
+ half_ch_funcs->get_fCTS(half_ch_s) ? 'C' : 'c',
+ half_ch_funcs->get_fCD(half_ch_s) ? 'C' : 'c',
+ half_ch_funcs->get_fRI(half_ch_s) ? 'I' : 'i',
+ half_ch_funcs->get_fHEAD(half_ch_s) ? 'W' : 'w',
+ half_ch_funcs->get_fTAIL(half_ch_s) ? 'R' : 'r',
+ half_ch_funcs->get_fSTATE(half_ch_s) ? 'S' : 's',
+ half_ch_funcs->get_fBLOCKREADINTR(half_ch_s) ? 'B' : 'b',
+ chstate(half_ch_funcs->get_state(half_ch_r)),
+ half_ch_funcs->get_tail(half_ch_r),
+ half_ch_funcs->get_head(half_ch_r),
+ half_ch_funcs->get_fDSR(half_ch_r) ? 'D' : 'd',
+ half_ch_funcs->get_fCTS(half_ch_r) ? 'C' : 'c',
+ half_ch_funcs->get_fCD(half_ch_r) ? 'C' : 'c',
+ half_ch_funcs->get_fRI(half_ch_r) ? 'I' : 'i',
+ half_ch_funcs->get_fHEAD(half_ch_r) ? 'W' : 'w',
+ half_ch_funcs->get_fTAIL(half_ch_r) ? 'R' : 'r',
+ half_ch_funcs->get_fSTATE(half_ch_r) ? 'S' : 's',
+ half_ch_funcs->get_fBLOCKREADINTR(half_ch_r) ? 'B' : 'b',
size
);
}
@@ -542,19 +547,33 @@
{
void *shared;
int n, i = 0;
+ struct smd_alloc_elm *ch_tbl;
+ unsigned ch_type;
+ unsigned shared_size;
+
+ ch_tbl = smem_find(ID_CH_ALLOC_TBL, sizeof(*ch_tbl) * 64);
+ if (!ch_tbl)
+ goto fail;
for (n = 0; n < SMD_CHANNELS; n++) {
+ ch_type = SMD_CHANNEL_TYPE(ch_tbl[n].type);
+ if (is_word_access_ch(ch_type))
+ shared_size =
+ sizeof(struct smd_half_channel_word_access);
+ else
+ shared_size = sizeof(struct smd_half_channel);
shared = smem_find(ID_SMD_CHANNELS + n,
- 2 * (sizeof(struct smd_half_channel) +
- SMD_BUF_SIZE));
+ 2 * shared_size + SMD_BUF_SIZE);
if (shared == 0)
continue;
i += dump_ch(buf + i, max - i, n, shared,
- (shared + sizeof(struct smd_half_channel) +
- SMD_BUF_SIZE), SMD_BUF_SIZE);
+ (shared + shared_size +
+ SMD_BUF_SIZE), get_half_ch_funcs(ch_type),
+ SMD_BUF_SIZE);
}
+fail:
return i;
}
#else
@@ -563,10 +582,23 @@
void *shared, *buffer;
unsigned buffer_sz;
int n, i = 0;
+ struct smd_alloc_elm *ch_tbl;
+ unsigned ch_type;
+ unsigned shared_size;
+
+ ch_tbl = smem_find(ID_CH_ALLOC_TBL, sizeof(*ch_tbl) * 64);
+ if (!ch_tbl)
+ goto fail;
for (n = 0; n < SMD_CHANNELS; n++) {
- shared = smem_find(ID_SMD_CHANNELS + n,
- 2 * sizeof(struct smd_half_channel));
+ ch_type = SMD_CHANNEL_TYPE(ch_tbl[n].type);
+ if (is_word_access_ch(ch_type))
+ shared_size =
+ sizeof(struct smd_half_channel_word_access);
+ else
+ shared_size = sizeof(struct smd_half_channel);
+
+ shared = smem_find(ID_SMD_CHANNELS + n, 2 * shared_size);
if (shared == 0)
continue;
@@ -577,10 +609,12 @@
continue;
i += dump_ch(buf + i, max - i, n, shared,
- (shared + sizeof(struct smd_half_channel)),
+ (shared + shared_size),
+ get_half_ch_funcs(ch_type),
buffer_sz / 2);
}
+fail:
return i;
}
#endif