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