| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bchp_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/16 $ |
|---|
| 12 | * $brcm_Date: 2/10/12 5:25p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/chp/bchp_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/16 2/10/12 5:25p rjlewis |
|---|
| 21 | * SW7425-2218: removed AvsLock/Unlock and added get handle. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/15 2/1/12 7:03p rjlewis |
|---|
| 24 | * SW7425-2216: Adding support for AVS Lock/Unlock. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/14 8/16/11 11:31a rjlewis |
|---|
| 27 | * SW7346-117: Added support for a chip specific stand-by mode function. |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/13 8/3/11 11:46a rjlewis |
|---|
| 30 | * SW7346-117: added support for GetAvsData function. |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/12 6/20/11 12:01p jtna |
|---|
| 33 | * SW7425-752: handle shared nodes correctly |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/11 1/20/11 1:40p gmohile |
|---|
| 36 | * SW7408-212 : Add support for avs settings |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/10 1/18/11 4:12p jtna |
|---|
| 39 | * SW7420-972: added initComplete member |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/9 11/18/10 7:33p jtna |
|---|
| 42 | * SW7420-972: refactor init process |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/8 10/20/10 6:45p jtna |
|---|
| 45 | * SW7420-972: rewrite to support HW_ -> HW_ dependency |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/7 9/24/10 4:29p jtna |
|---|
| 48 | * SW7420-972: change regHandle from void* to BREG_Handle |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/6 9/1/10 3:34p jtna |
|---|
| 51 | * SW7420-972: add bchp_pwr resource init scheme |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/5 8/20/10 12:31p jtna |
|---|
| 54 | * SW7405-4433: change pHandle to handle |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/4 8/19/10 3:10p jtna |
|---|
| 57 | * SW7405-4433: merge BCHP_PWR |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/3 6/10/04 5:43p jasonh |
|---|
| 60 | * PR 11257: Added initial support of BCHP_GetFeature for 7038 chipsets. |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/2 9/26/03 8:49a dlwin |
|---|
| 63 | * Updated to return 16 bits for Chip ID and Chip Rev. |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/1 9/24/03 11:30a dlwin |
|---|
| 66 | * Initial version |
|---|
| 67 | * |
|---|
| 68 | ***************************************************************************/ |
|---|
| 69 | #ifndef BCHP_PRIV_H__ |
|---|
| 70 | #define BCHP_PRIV_H__ |
|---|
| 71 | |
|---|
| 72 | #include "bstd.h" |
|---|
| 73 | #include "bchp.h" |
|---|
| 74 | #include "breg_mem.h" |
|---|
| 75 | #include "bkni_multi.h" |
|---|
| 76 | |
|---|
| 77 | #ifdef __cplusplus |
|---|
| 78 | extern "C" { |
|---|
| 79 | #endif |
|---|
| 80 | |
|---|
| 81 | /*************************************************************************** |
|---|
| 82 | Summary: |
|---|
| 83 | This typedef defines the pointer to chip Close function. |
|---|
| 84 | |
|---|
| 85 | Description: |
|---|
| 86 | If the close function pointer is used, then open function pointer must |
|---|
| 87 | also exist. |
|---|
| 88 | |
|---|
| 89 | See Also: |
|---|
| 90 | BCHP_Close() |
|---|
| 91 | |
|---|
| 92 | ****************************************************************************/ |
|---|
| 93 | typedef BERR_Code (*BCHP_CloseFunc)( |
|---|
| 94 | BCHP_Handle hChip /* [in] Chip handle */ |
|---|
| 95 | ); |
|---|
| 96 | |
|---|
| 97 | /*************************************************************************** |
|---|
| 98 | Summary: |
|---|
| 99 | This typedef defines the pointer to chip GetChipInfo function. |
|---|
| 100 | |
|---|
| 101 | Description: |
|---|
| 102 | This function pointer is provided for chips that requires specific needs |
|---|
| 103 | when BCHP_GetChipInfo() is called. |
|---|
| 104 | |
|---|
| 105 | See Also: |
|---|
| 106 | BCHP_GetChipInfo() |
|---|
| 107 | |
|---|
| 108 | ****************************************************************************/ |
|---|
| 109 | typedef BERR_Code (*BCHP_GetChipInfoFunc)( |
|---|
| 110 | const BCHP_Handle hChip, /* [in] Chip handle */ |
|---|
| 111 | uint16_t *pChipId, /* [out] Chip Id */ |
|---|
| 112 | uint16_t *pChipRev /* [out] Chip Rev. */ |
|---|
| 113 | ); |
|---|
| 114 | |
|---|
| 115 | /*************************************************************************** |
|---|
| 116 | Summary: |
|---|
| 117 | This typedef defines the pointer to chip GetFeature function. |
|---|
| 118 | |
|---|
| 119 | Description: |
|---|
| 120 | This function pointer is provided for chips that have specific features |
|---|
| 121 | that need to be queried. |
|---|
| 122 | |
|---|
| 123 | See Also: |
|---|
| 124 | BCHP_GetFeature() |
|---|
| 125 | |
|---|
| 126 | ****************************************************************************/ |
|---|
| 127 | typedef BERR_Code (*BCHP_GetFeatureFunc)( |
|---|
| 128 | const BCHP_Handle hChip, /* [in] Chip handle. */ |
|---|
| 129 | const BCHP_Feature eFeature, /* [in] Feature to be queried. */ |
|---|
| 130 | void *pFeatureValue /* [out] Feature value .*/ |
|---|
| 131 | ); |
|---|
| 132 | |
|---|
| 133 | /*************************************************************************** |
|---|
| 134 | Summary: |
|---|
| 135 | This typedef defines the pointer to chip MonitorPvt function. |
|---|
| 136 | |
|---|
| 137 | Description: |
|---|
| 138 | This function pointer is provided for chips that have AVS |
|---|
| 139 | |
|---|
| 140 | See Also: |
|---|
| 141 | BCHP_MonitorPvt() |
|---|
| 142 | |
|---|
| 143 | ****************************************************************************/ |
|---|
| 144 | typedef void (*BCHP_MonitorPvtFunc)( |
|---|
| 145 | const BCHP_Handle hChip, /* [in] Chip handle. */ |
|---|
| 146 | BCHP_AvsSettings *pSettings /* [in] AVS settings. */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | /*************************************************************************** |
|---|
| 151 | Summary: |
|---|
| 152 | This typedef defines the pointer to chip GetAvsData function. |
|---|
| 153 | |
|---|
| 154 | Description: |
|---|
| 155 | This function pointer is provided for chips that have AVS. |
|---|
| 156 | |
|---|
| 157 | See Also: |
|---|
| 158 | BCHP_GetAvsData() |
|---|
| 159 | |
|---|
| 160 | ****************************************************************************/ |
|---|
| 161 | typedef BERR_Code (*BCHP_GetAvsDataFunc)( |
|---|
| 162 | const BCHP_Handle hChip, /* [in] Chip handle */ |
|---|
| 163 | BCHP_AvsData *pData /* [out] pointer to location to return data */ |
|---|
| 164 | ); |
|---|
| 165 | |
|---|
| 166 | /*************************************************************************** |
|---|
| 167 | Summary: |
|---|
| 168 | This typedef defines the pointer to chip StandbyMode function. |
|---|
| 169 | |
|---|
| 170 | Description: |
|---|
| 171 | This function pointer is provided for chips that support changing power modes. |
|---|
| 172 | |
|---|
| 173 | See Also: |
|---|
| 174 | BCHP_StandbyMode() |
|---|
| 175 | |
|---|
| 176 | ****************************************************************************/ |
|---|
| 177 | typedef BERR_Code (*BCHP_StandbyModeFunc)( |
|---|
| 178 | const BCHP_Handle hChip, /* [in] Chip handle. */ |
|---|
| 179 | bool activate /* [in] true to activate standby mode */ |
|---|
| 180 | ); |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | typedef struct BCHP_PWR_P_Context { |
|---|
| 184 | BKNI_MutexHandle lock; /* for internal sync */ |
|---|
| 185 | |
|---|
| 186 | unsigned *pubRefcnt; /* public refcnt is non-recursive and enforces that you only release |
|---|
| 187 | what you've previously acquired. only applies to nonleaf nodes */ |
|---|
| 188 | |
|---|
| 189 | unsigned *privRefcnt; /* private refcnt is recursive. applies to all nodes */ |
|---|
| 190 | bool *init; /* every HW node must be initialized before it can be acquired/released. |
|---|
| 191 | initialized means powered down */ |
|---|
| 192 | bool initComplete; /* true if BCHP_PWR_P_Init() has completed */ |
|---|
| 193 | bool *magnumCtrl; /* true if MAGNUM_CONTROLLED HW_ node */ |
|---|
| 194 | bool *sharedCtrl; /* true if HW_ node has at least one HW_ node parent that is |
|---|
| 195 | MAGNUM_CONTROLLED and one that is not */ |
|---|
| 196 | } BCHP_PWR_P_Context; |
|---|
| 197 | |
|---|
| 198 | typedef struct BCHP_PWR_P_Context *BCHP_PWR_Handle; |
|---|
| 199 | typedef struct BCHP_AVS_P_Context *BCHP_AVS_Handle; |
|---|
| 200 | |
|---|
| 201 | typedef struct BCHP_P_Context |
|---|
| 202 | { |
|---|
| 203 | void *chipHandle; /* Chip Specific handle */ |
|---|
| 204 | BREG_Handle regHandle; /* register handle */ |
|---|
| 205 | BCHP_CloseFunc pCloseFunc; /* ptr to Close func. */ |
|---|
| 206 | BCHP_GetChipInfoFunc pGetChipInfoFunc; /* ptr to GetChipInfo func. */ |
|---|
| 207 | BCHP_GetFeatureFunc pGetFeatureFunc; /* ptr to GetFeature func. */ |
|---|
| 208 | BCHP_MonitorPvtFunc pMonitorPvtFunc; /* ptr to MonitorPvtFunc func. */ |
|---|
| 209 | BCHP_GetAvsDataFunc pGetAvsDataFunc; /* ptr to GetAvsDataFunc func. */ |
|---|
| 210 | BCHP_StandbyModeFunc pStandbyModeFunc; /* ptr to StandbyModeFunc func. */ |
|---|
| 211 | BCHP_PWR_Handle pwrManager; /* BCHP_PWR handle */ |
|---|
| 212 | BCHP_AVS_Handle avsHandle; /* BCHP_AVS handle */ |
|---|
| 213 | } BCHP_P_Context; |
|---|
| 214 | |
|---|
| 215 | typedef enum BCHP_PWR_P_ResourceType { |
|---|
| 216 | BCHP_PWR_P_ResourceType_eLeaf, /* a leaf node is always a HW_ node */ |
|---|
| 217 | BCHP_PWR_P_ResourceType_eNonLeaf, /* a non-leaf node that is not a HW_ node */ |
|---|
| 218 | BCHP_PWR_P_ResourceType_eNonLeafHw /* a non-leaf node that is also a HW_ node. |
|---|
| 219 | these nodes can only have other HW_ nodes as dependencies */ |
|---|
| 220 | |
|---|
| 221 | } BCHP_PWR_P_ResourceType; |
|---|
| 222 | |
|---|
| 223 | struct BCHP_PWR_P_Resource { |
|---|
| 224 | BCHP_PWR_P_ResourceType type; |
|---|
| 225 | unsigned id; /* the #define number */ |
|---|
| 226 | const char name[32]; |
|---|
| 227 | }; |
|---|
| 228 | |
|---|
| 229 | typedef struct BCHP_PWR_P_Resource BCHP_PWR_P_Resource; |
|---|
| 230 | |
|---|
| 231 | BERR_Code BCHP_PWR_Open( |
|---|
| 232 | BCHP_PWR_Handle *pHandle, /* [out] */ |
|---|
| 233 | BCHP_Handle chp /* [in] */ |
|---|
| 234 | ); |
|---|
| 235 | |
|---|
| 236 | void BCHP_PWR_Close( |
|---|
| 237 | BCHP_PWR_Handle handle /* [in] */ |
|---|
| 238 | ); |
|---|
| 239 | |
|---|
| 240 | #ifdef __cplusplus |
|---|
| 241 | } |
|---|
| 242 | #endif |
|---|
| 243 | |
|---|
| 244 | #endif /*BCHP_PRIV_H__*/ |
|---|
| 245 | |
|---|