iPXE
mlx_utils.h
Go to the documentation of this file.
1 #ifndef MLXUTILS_INCLUDE_PUBLIC_MLXUTILS_H_
2 #define MLXUTILS_INCLUDE_PUBLIC_MLXUTILS_H_
3 
4 /*
5  * Copyright (C) 2015 Mellanox Technologies Ltd.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA.
21  */
22 
23 FILE_LICENCE ( GPL2_OR_LATER );
24 
25 #include "mlx_logging.h"
26 #include "mlx_types.h"
27 
28 #define IN
29 #define OUT
30 
32 
33 typedef struct{
36 } __attribute__ (( packed )) mlx_pci_gw;
37 
38 typedef struct {
42 } __attribute__ (( packed )) mlx_icmd ;
43 
44 typedef struct{
48  void *lock;
49 #ifdef DEVICE_CX3
50  /* ACCESS to BAR0 */
51  void *config;
52 #endif
53 } __attribute__ (( packed )) mlx_utils;
54 
57  IN mlx_utils *utils,
58  IN mlx_pci *pci
59  );
60 
63  IN mlx_utils *utils
64  );
67  IN mlx_uint32 msecs
68  );
69 
72  IN mlx_uint32 usecs
73  );
74 
77  IN mlx_uint32 i,
78  OUT mlx_uint32 *log
79  );
80 
83  IN OUT mlx_utils *utils
84  );
85 
88  IN OUT mlx_utils *utils
89  );
90 
93  IN OUT mlx_utils *utils
94  );
95 
98  IN OUT mlx_utils *utils
99  );
100 
103  IN mlx_utils *utils,
104  OUT mlx_uint32 *rand_num
105  );
106 #endif /* STUB_MLXUTILS_INCLUDE_PUBLIC_MLXUTILS_H_ */
uint8_t mlx_boolean
#define __attribute__(x)
Definition: compiler.h:10
mlx_uint32 pci_cmd_offset
Definition: mlx_utils.h:34
mlx_status mlx_utils_release_lock(IN OUT mlx_utils *utils)
Definition: mlx_utils.c:108
mlx_pci_gw_space space
Definition: mlx_utils.h:35
mlx_status mlx_utils_delay_in_ms(IN mlx_uint32 msecs)
Definition: mlx_utils.c:57
mlx_status mlx_utils_delay_in_us(IN mlx_uint32 usecs)
Definition: mlx_utils.c:65
FILE_LICENCE(GPL2_OR_LATER)
uint32_t mlx_uint32
mlx_status mlx_utils_ilog2(IN mlx_uint32 i, OUT mlx_uint32 *log)
Definition: mlx_utils.c:73
mlx_icmd icmd
Definition: mlx_utils.h:47
#define OUT
Definition: mlx_utils.h:29
mlx_pci * pci
Definition: mlx_utils.h:45
mlx_boolean took_semaphore
Definition: mlx_utils.h:40
mlx_status mlx_utils_init(IN mlx_utils *utils, IN mlx_pci *pci)
Definition: mlx_utils.c:28
A PCI device.
Definition: pci.h:187
mlx_uint32 max_cmd_size
Definition: mlx_utils.h:41
mlx_status mlx_utils_teardown(IN mlx_utils *utils)
Definition: mlx_utils.c:46
uint16_t mlx_uint16
#define IN
Definition: mlx_utils.h:28
mlx_status mlx_utils_acquire_lock(IN OUT mlx_utils *utils)
Definition: mlx_utils.c:100
mlx_status mlx_utils_init_lock(IN OUT mlx_utils *utils)
Definition: mlx_utils.c:83
mlx_status mlx_utils_rand(IN mlx_utils *utils, OUT mlx_uint32 *rand_num)
Definition: mlx_utils.c:116
mlx_boolean icmd_opened
Definition: mlx_utils.h:39
int mlx_status
mlx_status mlx_utils_free_lock(IN OUT mlx_utils *utils)
Definition: mlx_utils.c:92
mlx_pci_gw pci_gw
Definition: mlx_utils.h:46
void * lock
Definition: mlx_utils.h:48
mlx_uint16 mlx_pci_gw_space
Definition: mlx_utils.h:31