diff options
author | Daniel Walker <c_dwalke@quicinc.com> | 2010-03-16 19:29:44 -0400 |
---|---|---|
committer | Daniel Walker <dwalker@codeaurora.org> | 2010-05-12 12:18:32 -0400 |
commit | bf83de4037780b11b27f1e32e33c1e8e7e42602e (patch) | |
tree | b2baf37c32a4b4fc036383162b4fcb8eb241e4ed /arch/arm/mach-msm | |
parent | 79848a2a7333eee6424b38c05b4ea4a0ce56eb47 (diff) |
arm: msm: smd: use either package v3 or v4 not both
This modifies SMD to use either the package v3 or package v4,
but not both. The current code tries to allocate as v4 on all
system which can produce a scary looking error message on boot up,
smem_find(16, 40): wrong size 16424
smd_alloc_channel() cid=02 size=08192 'SMD_RPCCALL'
With this error the code then falls back on the package v3 allocation
method. This method is inefficient because it causes a slow down
on some systems even when the allocation method can be determined
at compile time. It also causes a kernel size increase that effects
all system and is not needed.
This change corrects the allocation to use one method or the other
and not both.
Signed-off-by: Daniel Walker <c_dwalke@quicinc.com>
Diffstat (limited to 'arch/arm/mach-msm')
-rw-r--r-- | arch/arm/mach-msm/Kconfig | 24 | ||||
-rw-r--r-- | arch/arm/mach-msm/smd.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-msm/smd_private.h | 58 |
3 files changed, 78 insertions, 48 deletions
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 7cee7913f6f7..e73e9d17ca2e 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
@@ -1,5 +1,21 @@ | |||
1 | if ARCH_MSM | 1 | if ARCH_MSM |
2 | 2 | ||
3 | choice | ||
4 | prompt "Qualcomm MSM SoC Type" | ||
5 | default ARCH_MSM7X00A | ||
6 | |||
7 | config ARCH_MSM7X00A | ||
8 | bool "MSM7x00A / MSM7x01A" | ||
9 | select ARCH_MSM_ARM11 | ||
10 | select MSM_SMD_PKG3 | ||
11 | select CPU_V6 | ||
12 | |||
13 | endchoice | ||
14 | |||
15 | config ARCH_MSM_ARM11 | ||
16 | bool | ||
17 | |||
18 | |||
3 | comment "MSM Board Type" | 19 | comment "MSM Board Type" |
4 | depends on ARCH_MSM | 20 | depends on ARCH_MSM |
5 | 21 | ||
@@ -28,20 +44,22 @@ choice | |||
28 | endchoice | 44 | endchoice |
29 | 45 | ||
30 | config MACH_HALIBUT | 46 | config MACH_HALIBUT |
31 | depends on ARCH_MSM | 47 | depends on ARCH_MSM7X00A |
32 | select CPU_V6 | ||
33 | default y | 48 | default y |
34 | bool "Halibut Board (QCT SURF7201A)" | 49 | bool "Halibut Board (QCT SURF7201A)" |
35 | help | 50 | help |
36 | Support for the Qualcomm SURF7201A eval board. | 51 | Support for the Qualcomm SURF7201A eval board. |
37 | 52 | ||
38 | config MACH_TROUT | 53 | config MACH_TROUT |
39 | select CPU_V6 | 54 | depends on ARCH_MSM7X00A |
40 | default y | 55 | default y |
41 | bool "HTC Dream (aka trout)" | 56 | bool "HTC Dream (aka trout)" |
42 | help | 57 | help |
43 | Support for the HTC Dream, T-Mobile G1, Android ADP1 devices. | 58 | Support for the HTC Dream, T-Mobile G1, Android ADP1 devices. |
44 | 59 | ||
60 | config MSM_SMD_PKG3 | ||
61 | bool | ||
62 | |||
45 | config MSM_SMD | 63 | config MSM_SMD |
46 | default y | 64 | default y |
47 | bool "MSM Shared Memory Driver (SMD)" | 65 | bool "MSM Shared Memory Driver (SMD)" |
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c index b864592cbe05..130b7a72bea1 100644 --- a/arch/arm/mach-msm/smd.c +++ b/arch/arm/mach-msm/smd.c | |||
@@ -605,48 +605,6 @@ static int smd_packet_read(smd_channel_t *ch, void *data, int len) | |||
605 | return r; | 605 | return r; |
606 | } | 606 | } |
607 | 607 | ||
608 | static int smd_alloc_v2(struct smd_channel *ch) | ||
609 | { | ||
610 | struct smd_shared_v2 *shared2; | ||
611 | void *buffer; | ||
612 | unsigned buffer_sz; | ||
613 | |||
614 | shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2)); | ||
615 | buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz); | ||
616 | |||
617 | if (!buffer) | ||
618 | return -1; | ||
619 | |||
620 | /* buffer must be a power-of-two size */ | ||
621 | if (buffer_sz & (buffer_sz - 1)) | ||
622 | return -1; | ||
623 | |||
624 | buffer_sz /= 2; | ||
625 | ch->send = &shared2->ch0; | ||
626 | ch->recv = &shared2->ch1; | ||
627 | ch->send_data = buffer; | ||
628 | ch->recv_data = buffer + buffer_sz; | ||
629 | ch->fifo_size = buffer_sz; | ||
630 | return 0; | ||
631 | } | ||
632 | |||
633 | static int smd_alloc_v1(struct smd_channel *ch) | ||
634 | { | ||
635 | struct smd_shared_v1 *shared1; | ||
636 | shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1)); | ||
637 | if (!shared1) { | ||
638 | pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n); | ||
639 | return -1; | ||
640 | } | ||
641 | ch->send = &shared1->ch0; | ||
642 | ch->recv = &shared1->ch1; | ||
643 | ch->send_data = shared1->data0; | ||
644 | ch->recv_data = shared1->data1; | ||
645 | ch->fifo_size = SMD_BUF_SIZE; | ||
646 | return 0; | ||
647 | } | ||
648 | |||
649 | |||
650 | static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type) | 608 | static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type) |
651 | { | 609 | { |
652 | struct smd_channel *ch; | 610 | struct smd_channel *ch; |
@@ -658,7 +616,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type) | |||
658 | } | 616 | } |
659 | ch->n = cid; | 617 | ch->n = cid; |
660 | 618 | ||
661 | if (smd_alloc_v2(ch) && smd_alloc_v1(ch)) { | 619 | if (_smd_alloc_channel(ch)) { |
662 | kfree(ch); | 620 | kfree(ch); |
663 | return -1; | 621 | return -1; |
664 | } | 622 | } |
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h index 33a33f1b01f8..3d337ce35a61 100644 --- a/arch/arm/mach-msm/smd_private.h +++ b/arch/arm/mach-msm/smd_private.h | |||
@@ -61,7 +61,7 @@ struct smem_shared { | |||
61 | #define SMSM_V1_SIZE (sizeof(unsigned) * 8) | 61 | #define SMSM_V1_SIZE (sizeof(unsigned) * 8) |
62 | #define SMSM_V2_SIZE (sizeof(unsigned) * 4) | 62 | #define SMSM_V2_SIZE (sizeof(unsigned) * 4) |
63 | 63 | ||
64 | #ifndef CONFIG_ARCH_MSM_SCORPION | 64 | #ifdef CONFIG_MSM_SMD_PKG3 |
65 | struct smsm_interrupt_info { | 65 | struct smsm_interrupt_info { |
66 | uint32_t interrupt_mask; | 66 | uint32_t interrupt_mask; |
67 | uint32_t pending_interrupts; | 67 | uint32_t pending_interrupts; |
@@ -123,7 +123,7 @@ struct msm_dem_slave_data { | |||
123 | #define SMSM_WKUP_REASON_ALARM 0x00000010 | 123 | #define SMSM_WKUP_REASON_ALARM 0x00000010 |
124 | #define SMSM_WKUP_REASON_RESET 0x00000020 | 124 | #define SMSM_WKUP_REASON_RESET 0x00000020 |
125 | 125 | ||
126 | #ifndef CONFIG_ARCH_MSM_SCORPION | 126 | #ifdef CONFIG_ARCH_MSM7X00A |
127 | enum smsm_state_item { | 127 | enum smsm_state_item { |
128 | SMSM_STATE_APPS = 1, | 128 | SMSM_STATE_APPS = 1, |
129 | SMSM_STATE_MODEM = 3, | 129 | SMSM_STATE_MODEM = 3, |
@@ -265,6 +265,7 @@ struct smd_half_channel { | |||
265 | unsigned head; | 265 | unsigned head; |
266 | } __attribute__(( aligned(4), packed )); | 266 | } __attribute__(( aligned(4), packed )); |
267 | 267 | ||
268 | /* Only used on SMD package v3 on msm7201a */ | ||
268 | struct smd_shared_v1 { | 269 | struct smd_shared_v1 { |
269 | struct smd_half_channel ch0; | 270 | struct smd_half_channel ch0; |
270 | unsigned char data0[SMD_BUF_SIZE]; | 271 | unsigned char data0[SMD_BUF_SIZE]; |
@@ -272,6 +273,7 @@ struct smd_shared_v1 { | |||
272 | unsigned char data1[SMD_BUF_SIZE]; | 273 | unsigned char data1[SMD_BUF_SIZE]; |
273 | }; | 274 | }; |
274 | 275 | ||
276 | /* Used on SMD package v4 */ | ||
275 | struct smd_shared_v2 { | 277 | struct smd_shared_v2 { |
276 | struct smd_half_channel ch0; | 278 | struct smd_half_channel ch0; |
277 | struct smd_half_channel ch1; | 279 | struct smd_half_channel ch1; |
@@ -330,4 +332,56 @@ uint32_t raw_smsm_get_state(enum smsm_state_item item); | |||
330 | 332 | ||
331 | extern void msm_init_last_radio_log(struct module *); | 333 | extern void msm_init_last_radio_log(struct module *); |
332 | 334 | ||
335 | #ifdef CONFIG_MSM_SMD_PKG3 | ||
336 | /* | ||
337 | * This allocator assumes an SMD Package v3 which only exists on | ||
338 | * MSM7x00 SoC's. | ||
339 | */ | ||
340 | static inline int _smd_alloc_channel(struct smd_channel *ch) | ||
341 | { | ||
342 | struct smd_shared_v1 *shared1; | ||
343 | |||
344 | shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1)); | ||
345 | if (!shared1) { | ||
346 | pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n); | ||
347 | return -1; | ||
348 | } | ||
349 | ch->send = &shared1->ch0; | ||
350 | ch->recv = &shared1->ch1; | ||
351 | ch->send_data = shared1->data0; | ||
352 | ch->recv_data = shared1->data1; | ||
353 | ch->fifo_size = SMD_BUF_SIZE; | ||
354 | return 0; | ||
355 | } | ||
356 | #else | ||
357 | /* | ||
358 | * This allocator assumes an SMD Package v4, the most common | ||
359 | * and the default. | ||
360 | */ | ||
361 | static inline int _smd_alloc_channel(struct smd_channel *ch) | ||
362 | { | ||
363 | struct smd_shared_v2 *shared2; | ||
364 | void *buffer; | ||
365 | unsigned buffer_sz; | ||
366 | |||
367 | shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2)); | ||
368 | buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz); | ||
369 | |||
370 | if (!buffer) | ||
371 | return -1; | ||
372 | |||
373 | /* buffer must be a power-of-two size */ | ||
374 | if (buffer_sz & (buffer_sz - 1)) | ||
375 | return -1; | ||
376 | |||
377 | buffer_sz /= 2; | ||
378 | ch->send = &shared2->ch0; | ||
379 | ch->recv = &shared2->ch1; | ||
380 | ch->send_data = buffer; | ||
381 | ch->recv_data = buffer + buffer_sz; | ||
382 | ch->fifo_size = buffer_sz; | ||
383 | return 0; | ||
384 | } | ||
385 | #endif /* CONFIG_MSM_SMD_PKG3 */ | ||
386 | |||
333 | #endif | 387 | #endif |