iPXE
mlx_pci.c
Go to the documentation of this file.
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
20FILE_LICENCE ( GPL2_OR_LATER );
21
22#include <stddef.h>
23
26
29 IN mlx_utils *utils
30 )
31{
33 if( utils == NULL){
35 goto bail;
36 }
38bail:
39 return status;
40}
41
44 IN mlx_utils *utils
45 )
46{
48 if( utils == NULL){
50 goto bail;
51 }
53bail:
54 return status;
55}
56
59 IN mlx_utils *utils,
60 IN mlx_pci_width width,
64 )
65{
67 if( utils == NULL || count == 0){
69 goto bail;
70 }
71 status = mlx_pci_read_priv(utils, width, offset, count, buffer);
72bail:
73 return status;
74}
75
78 IN mlx_utils *utils,
79 IN mlx_pci_width width,
83 )
84{
86 if( utils == NULL || count == 0){
88 goto bail;
89 }
90 status = mlx_pci_write_priv(utils, width, offset, count, buffer);
91bail:
92 return status;
93}
94
97 IN mlx_utils *utils,
98 IN mlx_pci_width width,
99 IN mlx_uint8 bar_index,
103 )
104{
106 if( utils == NULL || count == 0){
108 goto bail;
109 }
110 status = mlx_pci_mem_read_priv(utils, width,bar_index, offset, count, buffer);
111bail:
112 return status;
113}
114
117 IN mlx_utils *utils,
118 IN mlx_pci_width width,
119 IN mlx_uint8 bar_index,
123 )
124{
126 if( utils == NULL || count == 0){
128 goto bail;
129 }
130 status = mlx_pci_mem_write_priv(utils, width, bar_index, offset, count, buffer);
131bail:
132 return status;
133}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
uint16_t offset
Offset to command line.
Definition bzimage.h:3
uint8_t status
Status.
Definition ena.h:5
static unsigned int count
Number of entries.
Definition dwmac.h:220
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition netvsc.h:5
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
mlx_status mlx_pci_mem_read(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, OUT mlx_void *buffer)
Definition mlx_pci.c:96
mlx_status mlx_pci_write(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint32 offset, IN mlx_uintn count, IN mlx_void *buffer)
Definition mlx_pci.c:77
mlx_status mlx_pci_mem_write(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, IN mlx_void *buffer)
Definition mlx_pci.c:116
mlx_status mlx_pci_read(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint32 offset, IN mlx_uintn count, OUT mlx_void *buffer)
Definition mlx_pci.c:58
mlx_status mlx_pci_teardown(IN mlx_utils *utils)
Definition mlx_pci.c:43
mlx_status mlx_pci_init(IN mlx_utils *utils)
Definition mlx_pci.c:28
mlx_pci_width
Definition mlx_pci.h:27
mlx_status mlx_pci_init_priv(IN mlx_utils *utils)
mlx_status mlx_pci_teardown_priv(IN mlx_utils *utils)
mlx_status mlx_pci_read_priv(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint32 offset, IN mlx_uintn count, OUT mlx_void *buffer)
mlx_status mlx_pci_write_priv(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint32 offset, IN mlx_uintn count, IN mlx_void *buffer)
mlx_status mlx_pci_mem_read_priv(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, OUT mlx_void *buffer)
mlx_status mlx_pci_mem_write_priv(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, IN mlx_void *buffer)
uint32_t mlx_uint32
uint64_t mlx_uint64
#define MLX_INVALID_PARAMETER
void mlx_void
#define MLX_SUCCESS
int mlx_status
uint8_t mlx_uint8
unsigned long mlx_uintn
#define IN
Definition mlx_utils.h:28
#define OUT
Definition mlx_utils.h:29