1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "dp_types.h"
21 #include "cdp_txrx_cmn_reg.h"
22 
23 void dp_configure_arch_ops(struct dp_soc *soc);
24 qdf_size_t dp_get_soc_context_size(uint16_t device_id);
25 
26 #ifdef CONFIG_LITHIUM
27 void dp_initialize_arch_ops_li(struct dp_arch_ops *arch_ops);
28 qdf_size_t dp_get_soc_context_size_li(void);
29 #endif
30 
31 #ifdef CONFIG_BERYLLIUM
32 void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops);
33 qdf_size_t dp_get_soc_context_size_be(void);
34 #endif
35 
36 #ifdef CONFIG_RHINE
37 void dp_initialize_arch_ops_rh(struct dp_arch_ops *arch_ops);
38 qdf_size_t dp_get_soc_context_size_rh(void);
39 #endif
40 
dp_initialize_default_arch_ops(struct dp_arch_ops * arch_ops)41 static void dp_initialize_default_arch_ops(struct dp_arch_ops *arch_ops)
42 {
43 /* assign dummy functions for arch_ops which are architecture specific */
44 }
45 
dp_get_soc_context_size(uint16_t device_id)46 qdf_size_t dp_get_soc_context_size(uint16_t device_id)
47 
48 {
49 	switch (cdp_get_arch_type_from_devid(device_id)) {
50 #ifdef CONFIG_LITHIUM
51 	case CDP_ARCH_TYPE_LI:
52 		return dp_get_soc_context_size_li();
53 #endif
54 
55 #ifdef CONFIG_BERYLLIUM
56 	case CDP_ARCH_TYPE_BE:
57 		return dp_get_soc_context_size_be();
58 	break;
59 #endif
60 #ifdef CONFIG_RHINE
61 	case CDP_ARCH_TYPE_RH:
62 		return dp_get_soc_context_size_rh();
63 	break;
64 #endif
65 
66 	default:
67 		QDF_BUG(0);
68 	}
69 
70 	return 0;
71 }
72 
dp_configure_arch_ops(struct dp_soc * soc)73 void dp_configure_arch_ops(struct dp_soc *soc)
74 {
75 	dp_initialize_default_arch_ops(&soc->arch_ops);
76 
77 	switch (cdp_get_arch_type_from_devid(soc->device_id)) {
78 #ifdef CONFIG_LITHIUM
79 	case CDP_ARCH_TYPE_LI:
80 		dp_initialize_arch_ops_li(&soc->arch_ops);
81 	break;
82 #endif
83 
84 #ifdef CONFIG_BERYLLIUM
85 	case CDP_ARCH_TYPE_BE:
86 		dp_initialize_arch_ops_be(&soc->arch_ops);
87 	break;
88 #endif
89 
90 #ifdef CONFIG_RHINE
91 	case CDP_ARCH_TYPE_RH:
92 		dp_initialize_arch_ops_rh(&soc->arch_ops);
93 	break;
94 #endif
95 
96 	default:
97 		QDF_BUG(0);
98 	}
99 }
100