rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2006 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * custom_config.c |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file contain definition of custom component module configuration variables, and routines |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * |
| 90 | *------------------------------------------------------------------------------ |
| 91 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 92 | *============================================================================ |
| 93 | ****************************************************************************/ |
| 94 | |
| 95 | /************************************************************************* |
| 96 | * Include Statements |
| 97 | *************************************************************************/ |
| 98 | #include "kal_general_types.h" |
| 99 | #include "kal_public_api.h" |
| 100 | #include "kal_public_defs.h" |
| 101 | #include "custom_FeatureConfig.h" |
| 102 | |
| 103 | /************************************************************************* |
| 104 | * FUNCTION |
| 105 | * custom_config_demp_page |
| 106 | * |
| 107 | * DESCRIPTION |
| 108 | * This routine configures pages for demand paging. |
| 109 | * |
| 110 | * PARAMETERS |
| 111 | * page - returned pointer to control blocks |
| 112 | * pool - returned pointer to page pool |
| 113 | * pool_size - returned pointer to page pool size |
| 114 | * |
| 115 | * RETURNS |
| 116 | * 0 fo success; -1 for failure. |
| 117 | * |
| 118 | ************************************************************************/ |
| 119 | #if defined(__DEMAND_PAGING__) |
| 120 | |
| 121 | #if defined(CONFIG_DEMAND_PAGE_SHARE_POOL_SIZE) |
| 122 | #define DEMP_PAGE_SHARE_POOL_SIZE CONFIG_DEMAND_PAGE_SHARE_POOL_SIZE |
| 123 | #else /* CONFIG_DEMAND_PAGE_SHARE_POOL_SIZE */ |
| 124 | |
| 125 | #if defined(__DEMAND_PAGING_V2__) |
| 126 | #if defined(MT6268) || defined(MT6268A) || defined(MT6268H) || defined(MT6268T) |
| 127 | #define DEMP_PAGE_SHARE_POOL_SIZE (2560 * 1024) |
| 128 | #define DEMP_MIN_SHARE_POOL_SIZE (2048 * 1024) |
| 129 | #else |
| 130 | #define DEMP_PAGE_SHARE_POOL_SIZE (2560 * 1024) |
| 131 | #define DEMP_MIN_SHARE_POOL_SIZE (2048 * 1024) |
| 132 | #endif |
| 133 | #else /*__DEMAND_PAGING_V2__*/ |
| 134 | #define DEMP_PAGE_SHARE_POOL_SIZE (2048 * 1024) |
| 135 | #define DEMP_MIN_SHARE_POOL_SIZE (2048 * 1024) |
| 136 | #endif /*__DEMAND_PAGING_V2__*/ |
| 137 | #endif /* CONFIG_DEMAND_PAGE_SHARE_POOL_SIZE */ |
| 138 | |
| 139 | #define DEMP_PAGE_POOL_SIZE (TOTAL_MAX_LOCK_SIZE + DEMP_PAGE_SHARE_POOL_SIZE) |
| 140 | |
| 141 | #if DEMP_MIN_SHARE_POOL_SIZE > DEMP_PAGE_SHARE_POOL_SIZE |
| 142 | #error "Pool size is smaller than minimum size!" |
| 143 | #endif |
| 144 | |
| 145 | #if defined (__DEMAND_PAGING_PERFORMANCE_PROFILING__) |
| 146 | |
| 147 | /* define page pool */ |
| 148 | #if defined(__MTK_TARGET__) |
| 149 | #pragma arm section zidata = "NONCACHEDZI" |
| 150 | // KeTing: To support change demand page pool on the fly, set to max allowable page by default |
| 151 | //static __align((2 << PAGE_CLUSTER) * 1024) kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_SIZE / 4]; |
| 152 | static __align((2 << PAGE_CLUSTER) * 1024) kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_MAX_SIZE / 4]; |
| 153 | #pragma arm section zidata |
| 154 | #else |
| 155 | //static kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_SIZE / 4]; |
| 156 | static kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_MAX_SIZE / 4]; |
| 157 | #endif /* MTK_TARGET */ |
| 158 | |
| 159 | /* define the control block for pages */ |
| 160 | //static demp_page_t DEMP_PAGE_LIST[DEMP_PAGE_POOL_SIZE >> (PAGE_SHIFT_2K + (PAGE_CLUSTER - 1))]; |
| 161 | static demp_page_t DEMP_PAGE_LIST[DEMP_PAGE_POOL_MAX_SIZE >> (PAGE_SHIFT_2K + (PAGE_CLUSTER - 1))]; |
| 162 | |
| 163 | #else /* __DEMAND_PAGING_PERFORMANCE_PROFILING__ */ |
| 164 | |
| 165 | /* define page pool */ |
| 166 | #if defined(__MTK_TARGET__) |
| 167 | #pragma arm section zidata = "NONCACHEDZI" |
| 168 | static __align((2 << PAGE_CLUSTER) * 1024) kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_SIZE / 4]; |
| 169 | #pragma arm section zidata |
| 170 | #else |
| 171 | static kal_uint32 DEMP_PAGE_POOL[DEMP_PAGE_POOL_SIZE / 4]; |
| 172 | #endif /* MTK_TARGET */ |
| 173 | |
| 174 | /* define the control block for pages */ |
| 175 | static demp_page_t DEMP_PAGE_LIST[DEMP_PAGE_POOL_SIZE >> (PAGE_SHIFT_2K + (PAGE_CLUSTER - 1))]; |
| 176 | |
| 177 | #endif /* __DEMAND_PAGING_PERFORMANCE_PROFILING__ */ |
| 178 | |
| 179 | #endif /* __DEMAND_PAGING__ */ |
| 180 | |
| 181 | kal_int32 |
| 182 | custom_config_demp_page(kal_uint32 **list, kal_uint32 **pool, kal_uint32 *pool_size) |
| 183 | { |
| 184 | #if defined(__DEMAND_PAGING__) |
| 185 | |
| 186 | if (list != NULL) { |
| 187 | *list = (kal_uint32 *)DEMP_PAGE_LIST; |
| 188 | } else { |
| 189 | return -1; |
| 190 | } |
| 191 | |
| 192 | if (pool != NULL) { |
| 193 | *pool = (kal_uint32 *)DEMP_PAGE_POOL; |
| 194 | } else { |
| 195 | return -1; |
| 196 | } |
| 197 | |
| 198 | if (pool_size != NULL) { |
| 199 | *pool_size = DEMP_PAGE_POOL_SIZE; |
| 200 | } else { |
| 201 | return -1; |
| 202 | } |
| 203 | |
| 204 | return 0; |
| 205 | |
| 206 | #else /* __DEMAND_PAGING__ */ |
| 207 | |
| 208 | return -1; |
| 209 | |
| 210 | #endif /* __DEMAND_PAGING__ */ |
| 211 | } |
| 212 | |