| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: bhsm.h $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 40 | * $brcm_Date: 3/27/12 8:35p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /magnum/portinginterface/hsm/7422/a0/common/bhsm.h $ |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/4 3/27/12 8:35p atruong |
|---|
| 49 | * SWSECURITY-116: Bug for BHCP_VER referencing fixed |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/3 10/18/11 9:41a atruong |
|---|
| 52 | * SWSECURITY-69: Support for 40-nm B0 Zeus 2.0 platforms |
|---|
| 53 | * |
|---|
| 54 | * Hydra_Software_Devel/2 1/24/11 10:49a atruong |
|---|
| 55 | * SW7422-26: Add HSM PI Support For 7422A0 - CC header format |
|---|
| 56 | * |
|---|
| 57 | ******************************************************************************/ |
|---|
| 58 | |
|---|
| 59 | #ifndef BHSM_H__ |
|---|
| 60 | #define BHSM_H__ |
|---|
| 61 | |
|---|
| 62 | #include "bchp.h" |
|---|
| 63 | |
|---|
| 64 | /* To support Zeus 2.0 and pre-Zeus platforms */ |
|---|
| 65 | #if (BCHP_CHIP == 7422) || (BCHP_CHIP==7425) || (BCHP_CHIP == 7346) || (BCHP_CHIP==7231) || \ |
|---|
| 66 | (BCHP_CHIP == 7344) || (BCHP_CHIP==7358) || (BCHP_CHIP == 7552) |
|---|
| 67 | #define HSM_IS_ASKM_40NM 1 |
|---|
| 68 | #if (BCHP_VER >= BCHP_VER_B0) |
|---|
| 69 | #define HSM_IS_ASKM_40NM_ZEUS_2_0 1 |
|---|
| 70 | #endif |
|---|
| 71 | #endif |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | #include "breg_mem.h" |
|---|
| 75 | |
|---|
| 76 | /* The following is for debug printing in user mode (AppFrameWork apps) */ |
|---|
| 77 | #if 0 |
|---|
| 78 | #ifdef USER_MODE_BHSM_DEBUG |
|---|
| 79 | #define BDBG_MSG(x) printf x |
|---|
| 80 | #define BDBG_ERR(x) printf x |
|---|
| 81 | #endif |
|---|
| 82 | #endif |
|---|
| 83 | |
|---|
| 84 | /* added to remove header file dependency chain*/ |
|---|
| 85 | #include "bhsm_priv.h" |
|---|
| 86 | |
|---|
| 87 | #ifdef __cplusplus |
|---|
| 88 | extern "C" { |
|---|
| 89 | #endif |
|---|
| 90 | |
|---|
| 91 | /* ??? Cannot use EnterCriticalSection while submitting any commands */ /* ??? BSYT, get rid of this */ |
|---|
| 92 | |
|---|
| 93 | /*************************************************************************** |
|---|
| 94 | Summary: |
|---|
| 95 | Host Secure Module (HSM) module context handle. |
|---|
| 96 | |
|---|
| 97 | Description: |
|---|
| 98 | Opaque handle that is created in BHSM_Open. |
|---|
| 99 | BHSM_Handle holds the context of the Host Secure Module. The system |
|---|
| 100 | should have only one BHSM_Handle. Caller of BHSM_Open is responsible to store |
|---|
| 101 | this BHSM_Handle and uses it for the future function call after BHSM_Open function |
|---|
| 102 | returns successfully. |
|---|
| 103 | |
|---|
| 104 | See Also: |
|---|
| 105 | BHSM_Open, BHSM_Channel_Open |
|---|
| 106 | |
|---|
| 107 | ****************************************************************************/ |
|---|
| 108 | typedef struct BHSM_P_Handle *BHSM_Handle; |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | /*************************************************************************** |
|---|
| 112 | Summary: |
|---|
| 113 | HSM channel context handle. |
|---|
| 114 | |
|---|
| 115 | Description: |
|---|
| 116 | Opaque handle that is created in BHSM_Channel_Open. |
|---|
| 117 | BHSM_ChannelHandle holds the context of the Host Secure Module channel. The system |
|---|
| 118 | may have more than one BHSM_ChannelHandle if the chip can support multiple |
|---|
| 119 | interfaces to submit Aegis commands. Caller of BHSM_Channel_Open is |
|---|
| 120 | responsible to store this BHSM_ChannelHandle and uses it for the future function |
|---|
| 121 | call after BHSM_Channel_Open function returns successfully. |
|---|
| 122 | |
|---|
| 123 | See Also: |
|---|
| 124 | BHSM_Open, BHSM_Channel_Open |
|---|
| 125 | |
|---|
| 126 | ****************************************************************************/ |
|---|
| 127 | typedef struct BHSM_P_ChannelHandle *BHSM_ChannelHandle; |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | /* Basic Module Functions */ |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | /***************************************************************************** |
|---|
| 138 | Summary: |
|---|
| 139 | This function returns a recommended default settings for HSM module. |
|---|
| 140 | |
|---|
| 141 | Description: |
|---|
| 142 | This function shall return a recommended default settings for HSM module. |
|---|
| 143 | This function shall be called before BHSM_Open |
|---|
| 144 | and the caller can then over-ride any of the default settings |
|---|
| 145 | required for the build and configuration by calling BHSM_Open. |
|---|
| 146 | |
|---|
| 147 | These default settings are always the same regardless of how |
|---|
| 148 | many times this function is called or what other functions have |
|---|
| 149 | been called in the porting interface. |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | Calling Context: |
|---|
| 153 | The function shall be called from application level (for example in |
|---|
| 154 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 155 | recommended ioctl: BHSM_IOCTL_GET_DEFAULT_SETTINGS) |
|---|
| 156 | |
|---|
| 157 | Performance and Timing: |
|---|
| 158 | This is a synchronous function that will return when it is done. |
|---|
| 159 | |
|---|
| 160 | Input: |
|---|
| 161 | in_chipHandle - BCHP_Handle, chip handle. |
|---|
| 162 | |
|---|
| 163 | Output: |
|---|
| 164 | outp_sSettings - BHSM_Settings, a ref/pointer to the default setting. |
|---|
| 165 | |
|---|
| 166 | Returns: |
|---|
| 167 | BERR_SUCCESS - success. Otherwise, there is an error. |
|---|
| 168 | |
|---|
| 169 | See Also: |
|---|
| 170 | BHSM_Open |
|---|
| 171 | BHSM_UpdateDefaultSettings |
|---|
| 172 | |
|---|
| 173 | *****************************************************************************/ |
|---|
| 174 | BERR_Code BHSM_GetDefaultSettings( |
|---|
| 175 | BHSM_Settings *outp_sSettings, |
|---|
| 176 | BCHP_Handle in_chipHandle |
|---|
| 177 | ); |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | /***************************************************************************** |
|---|
| 181 | Summary: |
|---|
| 182 | This function updates the HSM driver special controls, e.g. HSM run in ISR mode or polling mode. |
|---|
| 183 | |
|---|
| 184 | Description: |
|---|
| 185 | The default setting is using ISR inside HSM driver when receiving data from BSP. This function is provided to |
|---|
| 186 | select polling mode, or toggle ISR/Polling mode. It can also be used to modify the timeout value for polling |
|---|
| 187 | or ISR (the default is 2000 ms). It can only be invoked from non-critical calling code section. |
|---|
| 188 | |
|---|
| 189 | Calling Context: |
|---|
| 190 | Any time it can be called after BHSM initialization. |
|---|
| 191 | |
|---|
| 192 | Performance and Timing: |
|---|
| 193 | This will return immediately. |
|---|
| 194 | |
|---|
| 195 | Input: |
|---|
| 196 | netSettings- BHSM_NewSettings_t, select what to be updated and provide their corresponding values in this |
|---|
| 197 | structured data |
|---|
| 198 | whichControl - BHSM_SpecialCtrol_Flag_e, select what BHSM controls to update, one or multipe. |
|---|
| 199 | control bits shall not be overlapped. 1 to update the corresponding control. 0 for no update of it. |
|---|
| 200 | ctrlValue - unsigned long, what value is set for this control field. Bit0 is for ISR or Polling selection. |
|---|
| 201 | Other bits RFU. |
|---|
| 202 | timeoutMs - unsigned long, new timeout value for polling or wairt-for-ISR-from-BSP |
|---|
| 203 | |
|---|
| 204 | Output: |
|---|
| 205 | outp_sSettings - BHSM_Settings, a ref/pointer to the updated setting. |
|---|
| 206 | |
|---|
| 207 | Returns: |
|---|
| 208 | BERR_SUCCESS - success. Otherwise, there is an error. |
|---|
| 209 | |
|---|
| 210 | See Also: |
|---|
| 211 | BHSM_GetDefaultSettings |
|---|
| 212 | BHSM_SetSettings_isr |
|---|
| 213 | |
|---|
| 214 | *****************************************************************************/ |
|---|
| 215 | BERR_Code BHSM_SetSettings( |
|---|
| 216 | BHSM_Handle hHsm, |
|---|
| 217 | BHSM_NewSettings_t * netSettings |
|---|
| 218 | |
|---|
| 219 | ); |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | /***************************************************************************** |
|---|
| 223 | Summary: |
|---|
| 224 | This function updates the HSM driver special controls, e.g. HSM run in ISR mode or polling mode. |
|---|
| 225 | |
|---|
| 226 | Description: |
|---|
| 227 | The default setting is using ISR inside HSM driver when receiving data from BSP. This function is provided to |
|---|
| 228 | select polling mode, or toggle ISR/Polling mode. It can also be used to modify the timeout value for polling |
|---|
| 229 | or ISR (the default is 2000 ms). It can only be invoked from critical calling code section. |
|---|
| 230 | |
|---|
| 231 | Calling Context: |
|---|
| 232 | Any time it can be called after BHSM initialization. |
|---|
| 233 | |
|---|
| 234 | Performance and Timing: |
|---|
| 235 | This will return immediately. |
|---|
| 236 | |
|---|
| 237 | Input: |
|---|
| 238 | netSettings- BHSM_NewSettings_t, select what to be updated and provide their corresponding values in this |
|---|
| 239 | structured data |
|---|
| 240 | whichControl - BHSM_SpecialCtrol_Flag_e, select what BHSM controls to update, one or multipe. |
|---|
| 241 | control bits shall not be overlapped. 1 to update the corresponding control. 0 for no update of it. |
|---|
| 242 | ctrlValue - unsigned long, what value is set for this control field. Bit0 is for ISR or Polling selection. |
|---|
| 243 | Other bits RFU. |
|---|
| 244 | timeoutMs - unsigned long, new timeout value for polling or wairt-for-ISR-from-BSP |
|---|
| 245 | |
|---|
| 246 | Output: |
|---|
| 247 | outp_sSettings - BHSM_Settings, a ref/pointer to the updated setting. |
|---|
| 248 | |
|---|
| 249 | Returns: |
|---|
| 250 | BERR_SUCCESS - success. Otherwise, there is an error. |
|---|
| 251 | |
|---|
| 252 | See Also: |
|---|
| 253 | BHSM_GetDefaultSettings |
|---|
| 254 | BHSM_SetSettings |
|---|
| 255 | |
|---|
| 256 | *****************************************************************************/ |
|---|
| 257 | BERR_Code BHSM_SetSettings_isr( |
|---|
| 258 | BHSM_Handle hHsm, |
|---|
| 259 | BHSM_NewSettings_t * netSettings |
|---|
| 260 | |
|---|
| 261 | ); |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | /***************************************************************************** |
|---|
| 265 | Summary: |
|---|
| 266 | This function creates the Host Secure Module handle. |
|---|
| 267 | |
|---|
| 268 | Description: |
|---|
| 269 | This function shall create the Host Secure module handle. |
|---|
| 270 | It also initializes the Host Secure module |
|---|
| 271 | and hardware using settings stored in the outp_sSettings pointer. |
|---|
| 272 | All the associated channels are not ready to be access until |
|---|
| 273 | BHSM_ChannelOpen is called and returns successfully. |
|---|
| 274 | |
|---|
| 275 | The caller can pass a NULL pointer for inp_sSettings. If the |
|---|
| 276 | p_Settings pointer is NULL, default settings should be used. |
|---|
| 277 | |
|---|
| 278 | It is the caller responsibility to store the outp_handle and uses |
|---|
| 279 | it for the future function call after this function returns |
|---|
| 280 | successfully. |
|---|
| 281 | |
|---|
| 282 | Before calling this function, the only function that the caller |
|---|
| 283 | can call is BHSM_GetDefaultSettings. System shall not call |
|---|
| 284 | any other Host Secure functions prior to this function. |
|---|
| 285 | |
|---|
| 286 | System shall not call this function more than once without calling BHSM_Close |
|---|
| 287 | previously. |
|---|
| 288 | |
|---|
| 289 | If illegal settings are passed in an error should be |
|---|
| 290 | returned and the hardware state should not be modified. |
|---|
| 291 | |
|---|
| 292 | The BINT_Handle is only required if this module needs to |
|---|
| 293 | associate ISR callback routines with L2 interrupts. |
|---|
| 294 | |
|---|
| 295 | |
|---|
| 296 | Calling Context: |
|---|
| 297 | The function shall be called from application level (for example in |
|---|
| 298 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 299 | during insmod ) |
|---|
| 300 | |
|---|
| 301 | Performance and Timing: |
|---|
| 302 | This is a synchronous function that will return when it is done. |
|---|
| 303 | |
|---|
| 304 | Input: |
|---|
| 305 | in_regHandle - BREG_Handle, use to access Host Secure register. |
|---|
| 306 | in_chipHandle - BCHP_Handle, Chip handle. |
|---|
| 307 | in_interruptHandle - BINT_Handle, Interrupt handle to handle Host Secure interrupt. |
|---|
| 308 | in_xptHandle - BXPT_Handle, Transport handle. |
|---|
| 309 | inp_sSettings - BHSM_Settings, the settings that apply to multiple |
|---|
| 310 | channels. If NULL, a default setting shall be used. |
|---|
| 311 | |
|---|
| 312 | Output: |
|---|
| 313 | outp_handle - BHSM_Handle, a ref/pointer to the Host Secure module handle. |
|---|
| 314 | |
|---|
| 315 | Returns: |
|---|
| 316 | BERR_SUCCESS - success |
|---|
| 317 | |
|---|
| 318 | See Also: |
|---|
| 319 | BHSM_GetDefaultSettings |
|---|
| 320 | BHSM_Close |
|---|
| 321 | |
|---|
| 322 | ******************************************************************************/ |
|---|
| 323 | BERR_Code BHSM_Open( |
|---|
| 324 | BHSM_Handle *outp_handle, |
|---|
| 325 | BREG_Handle in_regHandle, |
|---|
| 326 | BCHP_Handle in_chipHandle, |
|---|
| 327 | BINT_Handle in_interruptHandle, |
|---|
| 328 | const BHSM_Settings *inp_sSettings |
|---|
| 329 | ); |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | /***************************************************************************** |
|---|
| 333 | Summary: |
|---|
| 334 | This function frees the main handle and any resources contained |
|---|
| 335 | in the main handle. |
|---|
| 336 | |
|---|
| 337 | Description: |
|---|
| 338 | This function shall free the main handle and any resources contained |
|---|
| 339 | in the main handle. This function shall try to free any resources associated |
|---|
| 340 | with sub handles created from the main handle. However, this function does not |
|---|
| 341 | free any resources associated with channel handle. |
|---|
| 342 | |
|---|
| 343 | Regardless of the return value, this function always attempts to free all |
|---|
| 344 | the allocated resources and inout_handle shall be NULL. |
|---|
| 345 | |
|---|
| 346 | Other than BHSM_GetDefaultSettings, system shall not call any other HSM |
|---|
| 347 | functions after this function returns, regardless of the return result. |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | Calling Context: |
|---|
| 351 | The function shall be called from application level (for example in |
|---|
| 352 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 353 | during rmmod) |
|---|
| 354 | |
|---|
| 355 | Performance and Timing: |
|---|
| 356 | This is a synchronous function that will return when it is done. |
|---|
| 357 | |
|---|
| 358 | Input: |
|---|
| 359 | in_handle - BHSM_Handle, Host Secure module handle. |
|---|
| 360 | |
|---|
| 361 | Returns: |
|---|
| 362 | BERR_SUCCESS - success |
|---|
| 363 | |
|---|
| 364 | See Also: |
|---|
| 365 | BHSM_Open |
|---|
| 366 | BHSM_GetDefaultSettings |
|---|
| 367 | |
|---|
| 368 | ******************************************************************************/ |
|---|
| 369 | BERR_Code BHSM_Close( |
|---|
| 370 | BHSM_Handle in_handle |
|---|
| 371 | ); |
|---|
| 372 | |
|---|
| 373 | |
|---|
| 374 | /***************************************************************************** |
|---|
| 375 | Summary: |
|---|
| 376 | This function returns the number of Host Secure Module channels |
|---|
| 377 | that we can support for the build and configuration. |
|---|
| 378 | |
|---|
| 379 | Description: |
|---|
| 380 | This function returns the number of Aegis command interfaces |
|---|
| 381 | that we can support for the build and configuration. |
|---|
| 382 | |
|---|
| 383 | The caller shall then call BHSM_Channel_Open or BHSM_GetChannelDefaultSettings |
|---|
| 384 | with in_channelNo that smaller than outp_totalChannels. |
|---|
| 385 | |
|---|
| 386 | Currently we support 2 Hardware Aegis Command interfaces. |
|---|
| 387 | |
|---|
| 388 | Calling Context: |
|---|
| 389 | The function shall be called from application level (for example in |
|---|
| 390 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 391 | recommended ioctl: BHSM_IOCTL_GET_TOTAL_CHANNELS or device open) |
|---|
| 392 | |
|---|
| 393 | Performance and Timing: |
|---|
| 394 | This is a synchronous function that will return when it is done. |
|---|
| 395 | |
|---|
| 396 | Input: |
|---|
| 397 | in_handle - BHSM_Handle, a ref/pointer to the Host Secure module handle. |
|---|
| 398 | |
|---|
| 399 | Output: |
|---|
| 400 | outp_ucTotalChannels - unsigned char, a ref/pointer to number of supported |
|---|
| 401 | Aegis command interfaces |
|---|
| 402 | |
|---|
| 403 | Returns: |
|---|
| 404 | BERR_SUCCESS - success |
|---|
| 405 | |
|---|
| 406 | |
|---|
| 407 | See Also: |
|---|
| 408 | BHSM_GetChannel |
|---|
| 409 | |
|---|
| 410 | ******************************************************************************/ |
|---|
| 411 | BERR_Code BHSM_GetTotalChannels( |
|---|
| 412 | BHSM_Handle in_handle, |
|---|
| 413 | unsigned char *outp_ucTotalChannels |
|---|
| 414 | ); |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | /***************************************************************************** |
|---|
| 418 | Summary: |
|---|
| 419 | This function returns a recommended default settings for HSM channel. |
|---|
| 420 | |
|---|
| 421 | Description: |
|---|
| 422 | This function shall return a recommended default settings for HSM channel. |
|---|
| 423 | This function shall be called before BHSM_Channel_Open |
|---|
| 424 | and the caller can then over-ride any of the default settings |
|---|
| 425 | required for the build and configuration by calling BHSM_Channel_Open. |
|---|
| 426 | |
|---|
| 427 | The caller shall pass in_channelNo that is smaller than outp_totalChannels in |
|---|
| 428 | BHSM_GetTotalChannels. The in_channelNo for the first channel shall be zero. |
|---|
| 429 | |
|---|
| 430 | These default settings are always the same regardless of how |
|---|
| 431 | many times this function is called or what other functions have |
|---|
| 432 | been called in the porting interface. |
|---|
| 433 | |
|---|
| 434 | Calling Context: |
|---|
| 435 | The function shall be called from application level (for example in |
|---|
| 436 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 437 | recommended ioctl: BHSM_IOCTL_GET_CHANNEL_DEFAULT_SETTINGS) |
|---|
| 438 | |
|---|
| 439 | Performance and Timing: |
|---|
| 440 | This is a synchronous function that will return when it is done. |
|---|
| 441 | |
|---|
| 442 | Input: |
|---|
| 443 | in_handle - BHSM_Handle, Host Secure module handle. |
|---|
| 444 | in_channelNo - BHSM_HwModule, an index that indicates which channel or Aegis |
|---|
| 445 | command interface that the caller want to access. |
|---|
| 446 | Output: |
|---|
| 447 | outp_sSettings - BHSM__ChannelSettings, a ref/pointer to the default channel |
|---|
| 448 | setting. |
|---|
| 449 | |
|---|
| 450 | Returns: |
|---|
| 451 | BERR_SUCCESS - success |
|---|
| 452 | |
|---|
| 453 | See Also: |
|---|
| 454 | BHSM_Open |
|---|
| 455 | BHSM_GetTotalChannels |
|---|
| 456 | BHSM_Channel_Open |
|---|
| 457 | |
|---|
| 458 | *****************************************************************************/ |
|---|
| 459 | BERR_Code BHSM_GetChannelDefaultSettings( |
|---|
| 460 | BHSM_Handle in_handle, |
|---|
| 461 | BHSM_HwModule in_channelNo, |
|---|
| 462 | BHSM_ChannelSettings *outp_sSettings |
|---|
| 463 | ); |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | |
|---|
| 467 | /***************************************************************************** |
|---|
| 468 | Summary: |
|---|
| 469 | This function creates the Host Secure channel handle. |
|---|
| 470 | |
|---|
| 471 | Description: |
|---|
| 472 | This function shall create the Host Secure channel handle. |
|---|
| 473 | It also initializes the specified Host Secure interface and all the associated registers |
|---|
| 474 | using settings stored in the inp_channelDefSettings pointer. |
|---|
| 475 | |
|---|
| 476 | The caller shall pass in_channelNo that is smaller than outp_totalChannels in |
|---|
| 477 | BHSM_GetTotalChannels. The in_channelNo for the first channel shall be zero. |
|---|
| 478 | |
|---|
| 479 | It is the responsibility of caller to specify the correct in_channelNo for |
|---|
| 480 | different Aegis command interface. |
|---|
| 481 | |
|---|
| 482 | The caller can pass a NULL pointer for inp_channelDefSettings. If the |
|---|
| 483 | inp_channelDefSettings pointer is NULL, default settings should be used. |
|---|
| 484 | |
|---|
| 485 | It is the caller responsibility to store the outp_channelHandle and uses |
|---|
| 486 | it for the future function call after this function returns |
|---|
| 487 | successfully. |
|---|
| 488 | |
|---|
| 489 | Before calling this function, the only channel related functions that the system |
|---|
| 490 | can call are BHSM_GetTotalChannels and BHSM_GetChannelDefaultSettings. |
|---|
| 491 | System shall not call any other channel related functions prior to this function. |
|---|
| 492 | |
|---|
| 493 | System shall not call this function more than once without calling BHSM_Channel_Close |
|---|
| 494 | previously. |
|---|
| 495 | |
|---|
| 496 | If illegal settings are passed in an error should be |
|---|
| 497 | returned and the hardware state should not be modified. |
|---|
| 498 | |
|---|
| 499 | |
|---|
| 500 | Calling Context: |
|---|
| 501 | The function shall be called from application level (for example in |
|---|
| 502 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 503 | recommended ioctl: BHSM_IOCTL_CHANNEL_OPEN |
|---|
| 504 | |
|---|
| 505 | Performance and Timing: |
|---|
| 506 | This is a synchronous function that will return when it is done. |
|---|
| 507 | |
|---|
| 508 | Input: |
|---|
| 509 | in_handle - BHSM__Handle, Host Secure module handle. |
|---|
| 510 | in_channelNo - BHSM_HwModule, an index that indicates which channel |
|---|
| 511 | that the caller want to access. |
|---|
| 512 | inp_channelDefSettings - BHSM_ChannelSettings, the channel settings that apply to this |
|---|
| 513 | specific channel. If NULL, a default channel setting shall be used. |
|---|
| 514 | |
|---|
| 515 | Output: |
|---|
| 516 | outp_channelHandle -BHSM_ChannelHandle, a ref/pointer to the host secure module. |
|---|
| 517 | |
|---|
| 518 | Returns: |
|---|
| 519 | BERR_SUCCESS - success |
|---|
| 520 | |
|---|
| 521 | See Also: |
|---|
| 522 | BHSM_Open |
|---|
| 523 | BHSM_GetTotalChannels |
|---|
| 524 | BHSM_Channel_Close |
|---|
| 525 | |
|---|
| 526 | |
|---|
| 527 | *****************************************************************************/ |
|---|
| 528 | BERR_Code BHSM_Channel_Open( |
|---|
| 529 | BHSM_Handle in_handle, |
|---|
| 530 | BHSM_ChannelHandle *outp_channelHandle, |
|---|
| 531 | BHSM_HwModule in_channelNo, |
|---|
| 532 | const BHSM_ChannelSettings *inp_channelDefSettings |
|---|
| 533 | ); |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | /***************************************************************************** |
|---|
| 537 | Summary: |
|---|
| 538 | This function frees the channel handle and any resources contained |
|---|
| 539 | in the channel handle. |
|---|
| 540 | |
|---|
| 541 | Description: |
|---|
| 542 | This function shall free the channel handle and any resources contained |
|---|
| 543 | in the channel handle. |
|---|
| 544 | |
|---|
| 545 | This function always returns successfully even if some of the resources cannot |
|---|
| 546 | be freed successfully. |
|---|
| 547 | |
|---|
| 548 | Other than BHSM_GetTotalChannels and BHSM_GetChannelDefaultSettings, system |
|---|
| 549 | shall not call any other channel related functions after this function returns, |
|---|
| 550 | regardless of the return result. |
|---|
| 551 | |
|---|
| 552 | Calling Context: |
|---|
| 553 | The function shall be called from application level (for example in |
|---|
| 554 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 555 | recommended ioctl: BHSM_IOCTL_CHANNEL_CLOSE) |
|---|
| 556 | |
|---|
| 557 | Performance and Timing: |
|---|
| 558 | This is a synchronous function that will return when it is done. |
|---|
| 559 | |
|---|
| 560 | Input: |
|---|
| 561 | in_channelHandle - BHSM_ChannelHandle, host secure module channel handle. |
|---|
| 562 | |
|---|
| 563 | Returns: |
|---|
| 564 | BERR_SUCCESS - success |
|---|
| 565 | |
|---|
| 566 | See Also: |
|---|
| 567 | BHSM_Channel_Open |
|---|
| 568 | |
|---|
| 569 | ******************************************************************************/ |
|---|
| 570 | BERR_Code BHSM_Channel_Close( |
|---|
| 571 | BHSM_ChannelHandle in_channelHandle |
|---|
| 572 | ); |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | /***************************************************************************** |
|---|
| 576 | Summary: |
|---|
| 577 | This function gets the module handle based on the channel handle. |
|---|
| 578 | |
|---|
| 579 | Description: |
|---|
| 580 | This function shall get the module handle based on the channel handle. |
|---|
| 581 | |
|---|
| 582 | Calling Context: |
|---|
| 583 | The function shall be called from application level (for example in |
|---|
| 584 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 585 | recommended ioctl: BHSM_IOCTL_GET_DEVICE) |
|---|
| 586 | |
|---|
| 587 | Performance and Timing: |
|---|
| 588 | This is a synchronous function that will return when it is done. |
|---|
| 589 | |
|---|
| 590 | Input: |
|---|
| 591 | in_channelHandle - BHSM_ChannelHandle, host secure module channel handle. |
|---|
| 592 | |
|---|
| 593 | Output: |
|---|
| 594 | outp_handle - BHSM_Handle, a ref/pointer to the host secure module handle. |
|---|
| 595 | |
|---|
| 596 | Returns: |
|---|
| 597 | BERR_SUCCESS - success |
|---|
| 598 | |
|---|
| 599 | See Also: |
|---|
| 600 | BHSM_Open |
|---|
| 601 | BHSM_Channel_Open |
|---|
| 602 | |
|---|
| 603 | *****************************************************************************/ |
|---|
| 604 | BERR_Code BHSM_GetDevice( |
|---|
| 605 | BHSM_ChannelHandle in_channelHandle, |
|---|
| 606 | BHSM_Handle *outp_handle |
|---|
| 607 | ); |
|---|
| 608 | |
|---|
| 609 | |
|---|
| 610 | /***************************************************************************** |
|---|
| 611 | Summary: |
|---|
| 612 | This function returns the specific Host Secure Module channel handle. |
|---|
| 613 | |
|---|
| 614 | Description: |
|---|
| 615 | This function returns the specific Host Secure module channel handle. |
|---|
| 616 | The caller shall pass in_index that is smaller than outp_totalChannels in |
|---|
| 617 | BHSM_GetTotalChannels. The in_index for the first channel |
|---|
| 618 | shall be zero and the second channel shall be 1. |
|---|
| 619 | It is the caller responsibility to store the return outp_channelHandle |
|---|
| 620 | for the future function calls after this function returns successfully. |
|---|
| 621 | |
|---|
| 622 | Before calling this function, the only functions that the system |
|---|
| 623 | can call are BHSM_GetDefaultSettings, BHSM_Open, BHSM_GetTotalChannels, |
|---|
| 624 | and BHSM_Close. |
|---|
| 625 | |
|---|
| 626 | |
|---|
| 627 | Calling Context: |
|---|
| 628 | The function shall be called from application level (for example in |
|---|
| 629 | VxWorks or no-os) or from driver level (for example in Linux, |
|---|
| 630 | recommended ioctl: BHSM_IOCTL_GET_CHANNEL ) |
|---|
| 631 | |
|---|
| 632 | Performance and Timing: |
|---|
| 633 | This is a synchronous function that will return when it is done. |
|---|
| 634 | |
|---|
| 635 | Input: |
|---|
| 636 | in_handle - BHSM_Handle, a ref/pointer to the Host Secure module handle. |
|---|
| 637 | in_channelNo - BHSM_HwModule, an index that indicate which channel or host secure module |
|---|
| 638 | slot that the caller want to access. |
|---|
| 639 | |
|---|
| 640 | Output: |
|---|
| 641 | outp_channelHandle - BHSM_ChannelHandle, a ref/pointer to the Host Secure |
|---|
| 642 | channel handle. |
|---|
| 643 | |
|---|
| 644 | Returns: |
|---|
| 645 | BERR_SUCCESS - success |
|---|
| 646 | |
|---|
| 647 | |
|---|
| 648 | See Also: |
|---|
| 649 | BHSM_GetTotalChannels |
|---|
| 650 | |
|---|
| 651 | ******************************************************************************/ |
|---|
| 652 | BERR_Code BHSM_GetChannel( |
|---|
| 653 | BHSM_Handle in_handle, |
|---|
| 654 | BHSM_HwModule in_channelNo, |
|---|
| 655 | BHSM_ChannelHandle *outp_channelHandle |
|---|
| 656 | ); |
|---|
| 657 | |
|---|
| 658 | /* End of Basic Module Functions */ |
|---|
| 659 | |
|---|
| 660 | /* Module Specific Functions */ |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | |
|---|
| 664 | /***************************************************************************** |
|---|
| 665 | Summary: |
|---|
| 666 | |
|---|
| 667 | This function is reserved for Broadcom internal usage only. |
|---|
| 668 | |
|---|
| 669 | ******************************************************************************/ |
|---|
| 670 | BERR_Code BHSM_SetIntrCallback( |
|---|
| 671 | BHSM_Handle in_handle, |
|---|
| 672 | BHSM_IntrType in_eIntType, |
|---|
| 673 | BHSM_IsrCallbackFunc in_callback |
|---|
| 674 | ); |
|---|
| 675 | |
|---|
| 676 | |
|---|
| 677 | |
|---|
| 678 | |
|---|
| 679 | #ifdef BHSM_AUTO_TEST |
|---|
| 680 | /***************************************************************************** |
|---|
| 681 | Summary: |
|---|
| 682 | |
|---|
| 683 | This function is reserved for Broadcom internal usage only. |
|---|
| 684 | |
|---|
| 685 | ******************************************************************************/ |
|---|
| 686 | BERR_Code BHSM_SubmitRawCommand ( |
|---|
| 687 | BHSM_Handle in_handle, |
|---|
| 688 | BHSM_HwModule in_interface, |
|---|
| 689 | uint32_t in_unInputParamLenInWord, |
|---|
| 690 | uint32_t *inp_unInputParamsBuf, |
|---|
| 691 | uint32_t *outp_unOutputParamLenInWord, |
|---|
| 692 | uint32_t *outp_unOutputParamsBuf |
|---|
| 693 | ); |
|---|
| 694 | #endif |
|---|
| 695 | |
|---|
| 696 | /* End of Module Specific Functions */ |
|---|
| 697 | |
|---|
| 698 | |
|---|
| 699 | #ifdef __cplusplus |
|---|
| 700 | } |
|---|
| 701 | #endif |
|---|
| 702 | |
|---|
| 703 | |
|---|
| 704 | #endif /* BHSM_H__ */ |
|---|
| 705 | |
|---|
| 706 | |
|---|
| 707 | |
|---|
| 708 | |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | |
|---|