~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/drivers/infiniband/mlx_utils/src/public/mlx_utils.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Mellanox Technologies Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public License as
 
6
 * published by the Free Software Foundation; either version 2 of the
 
7
 * License, or any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but
 
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
 * 02110-1301, USA.
 
18
 */
 
19
 
 
20
FILE_LICENCE ( GPL2_OR_LATER );
 
21
 
 
22
#include <stddef.h>
 
23
#include "../../include/private/mlx_utils_priv.h"
 
24
#include "../../include/public/mlx_pci.h"
 
25
#include "../../include/public/mlx_utils.h"
 
26
 
 
27
mlx_status
 
28
mlx_utils_init(
 
29
                                IN mlx_utils *utils,
 
30
                                IN mlx_pci *pci
 
31
                                )
 
32
{
 
33
        mlx_status status = MLX_SUCCESS;
 
34
        if( pci == NULL || utils == NULL ){
 
35
                status = MLX_INVALID_PARAMETER;
 
36
                goto bail;
 
37
        }
 
38
        utils->pci = pci;
 
39
        status = mlx_pci_init(utils);
 
40
        status = mlx_utils_init_lock(utils);
 
41
bail:
 
42
        return status;
 
43
}
 
44
 
 
45
mlx_status
 
46
mlx_utils_teardown(
 
47
                                IN mlx_utils *utils __attribute__ ((unused))
 
48
                                )
 
49
{
 
50
        mlx_status status = MLX_SUCCESS;
 
51
        mlx_utils_free_lock(utils);
 
52
        return status;
 
53
}
 
54
 
 
55
mlx_status
 
56
mlx_utils_delay_in_ms(
 
57
                        IN mlx_uint32 msecs
 
58
                )
 
59
{
 
60
        mlx_utils_delay_in_ms_priv(msecs);
 
61
        return MLX_SUCCESS;
 
62
}
 
63
mlx_status
 
64
mlx_utils_delay_in_us(
 
65
                        IN mlx_uint32 usecs
 
66
                )
 
67
{
 
68
        mlx_utils_delay_in_us_priv(usecs);
 
69
        return MLX_SUCCESS;
 
70
}
 
71
mlx_status
 
72
mlx_utils_ilog2(
 
73
                        IN mlx_uint32 i,
 
74
                        OUT mlx_uint32 *log
 
75
                )
 
76
{
 
77
        mlx_utils_ilog2_priv(i, log);
 
78
        return MLX_SUCCESS;
 
79
}
 
80
 
 
81
mlx_status
 
82
mlx_utils_init_lock(
 
83
                        IN OUT mlx_utils *utils
 
84
                )
 
85
{
 
86
        return mlx_utils_init_lock_priv(&(utils->lock));
 
87
 
 
88
}
 
89
 
 
90
mlx_status
 
91
mlx_utils_free_lock(
 
92
                        IN OUT mlx_utils *utils
 
93
                )
 
94
{
 
95
        return mlx_utils_free_lock_priv(utils->lock);
 
96
}
 
97
 
 
98
mlx_status
 
99
mlx_utils_acquire_lock (
 
100
                        IN OUT mlx_utils *utils
 
101
                )
 
102
{
 
103
        return mlx_utils_acquire_lock_priv(utils->lock);
 
104
}
 
105
 
 
106
mlx_status
 
107
mlx_utils_release_lock (
 
108
                IN OUT mlx_utils *utils
 
109
                )
 
110
{
 
111
        return mlx_utils_release_lock_priv(utils->lock);
 
112
}
 
113
 
 
114
mlx_status
 
115
mlx_utils_rand (
 
116
                IN mlx_utils *utils,
 
117
                OUT mlx_uint32 *rand_num
 
118
                )
 
119
{
 
120
        return mlx_utils_rand_priv(utils, rand_num);
 
121
}