[golan] Add Connect-IB, ConnectX-4 and ConnectX-4 Lx (Infiniband) support
[ipxe.git] / src / drivers / infiniband / mlx_utils / include / public / mlx_pci_gw.h
1 #ifndef INCLUDE_PUBLIC_MLX_PCI_GW_H_
2 #define INCLUDE_PUBLIC_MLX_PCI_GW_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_utils.h"
26
27 #define PCI_GW_FIRST_CAPABILITY_POINTER_OFFSET 0x34
28
29 #define PCI_GW_CAPABILITY_ID 0x9
30
31 #define PCI_GW_CAPABILITY_ID_OFFSET 0x0
32 #define PCI_GW_CAPABILITY_NEXT_POINTER_OFFSET 0x1
33 #define PCI_GW_CAPABILITY_SPACE_OFFSET 0x4
34 #define PCI_GW_CAPABILITY_STATUS_OFFSET 0x7
35 #define PCI_GW_CAPABILITY_COUNTER_OFFSET 0x8
36 #define PCI_GW_CAPABILITY_SEMAPHORE_OFFSET 0xC
37 #define PCI_GW_CAPABILITY_ADDRESS_OFFSET 0x10
38 #define PCI_GW_CAPABILITY_FLAG_OFFSET 0x10
39 #define PCI_GW_CAPABILITY_DATA_OFFSET 0x14
40
41 #define PCI_GW_SEMPHORE_TRIES 3000000
42 #define PCI_GW_GET_OWNERSHIP_TRIES 5000
43 #define PCI_GW_READ_FLAG_TRIES 3000000
44
45 #define PCI_GW_WRITE_FLAG 0x80000000
46
47 #define PCI_GW_SPACE_NODNIC 0x4
48 #define PCI_GW_SPACE_ALL_ICMD 0x3
49 #define PCI_GW_SPACE_SEMAPHORE 0xa
50 #define PCI_GW_SPACE_CR0 0x2
51
52 typedef mlx_uint32 mlx_pci_gw_buffer;
53
54
55 mlx_status
56 mlx_pci_gw_init(
57 IN mlx_utils *utils
58 );
59 mlx_status
60 mlx_pci_gw_teardown(
61 IN mlx_utils *utils
62 );
63 mlx_status
64 mlx_pci_gw_read(
65 IN mlx_utils *utils,
66 IN mlx_pci_gw_space space,
67 IN mlx_uint32 address,
68 OUT mlx_pci_gw_buffer *buffer
69 );
70
71 mlx_status
72 mlx_pci_gw_write(
73 IN mlx_utils *utils,
74 IN mlx_pci_gw_space space,
75 IN mlx_uint32 address,
76 IN mlx_pci_gw_buffer buffer
77 );
78
79
80
81 #endif /* INCLUDE_PUBLIC_MLX_PCI_GW_H_ */