[golan] Add Connect-IB, ConnectX-4 and ConnectX-4 Lx (Infiniband) support
[ipxe.git] / src / drivers / infiniband / mlx_utils_flexboot / src / mlx_utils_priv.c
1 /*
2 * MlxUtilsPriv.c
3 *
4 * Created on: Jan 25, 2015
5 * Author: maord
6 */
7
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <strings.h>
11 #include "../../mlx_utils/include/private/mlx_utils_priv.h"
12
13 mlx_status
14 mlx_utils_delay_in_ms_priv(
15 IN mlx_uint32 msecs
16 )
17 {
18 mdelay(msecs);
19 return MLX_SUCCESS;
20 }
21
22 mlx_status
23 mlx_utils_delay_in_us_priv(
24 IN mlx_uint32 usecs
25 )
26 {
27 udelay(usecs);
28 return MLX_SUCCESS;
29 }
30
31 mlx_status
32 mlx_utils_ilog2_priv(
33 IN mlx_uint32 i,
34 OUT mlx_uint32 *log
35 )
36 {
37 *log = ( fls ( i ) - 1 );
38 return MLX_SUCCESS;
39 }
40
41 mlx_status
42 mlx_utils_init_lock_priv(
43 OUT void **lock __unused
44 )
45 {
46 return MLX_SUCCESS;
47 }
48
49 mlx_status
50 mlx_utils_free_lock_priv(
51 IN void *lock __unused
52 )
53 {
54 return MLX_SUCCESS;
55 }
56
57 mlx_status
58 mlx_utils_acquire_lock_priv (
59 IN void *lock __unused
60 )
61 {
62 return MLX_SUCCESS;
63 }
64
65 mlx_status
66 mlx_utils_release_lock_priv (
67 IN void *lock __unused
68 )
69 {
70 return MLX_SUCCESS;
71 }
72
73 mlx_status
74 mlx_utils_rand_priv (
75 IN mlx_utils *utils __unused,
76 OUT mlx_uint32 *rand_num
77 )
78 {
79 do {
80 *rand_num = rand();
81 } while ( *rand_num == 0 );
82 return MLX_SUCCESS;
83 }