iPXE
mlx_pci_priv.h File Reference

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
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)

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER )

References buffer, count, IN, offset, and OUT.

◆ mlx_pci_init_priv()

mlx_status mlx_pci_init_priv ( IN mlx_utils * utils)

Definition at line 111 of file mlx_pci_priv.c.

114{
116 adjust_pci_device ( utils->pci );
117#ifdef DEVICE_CX3
118 utils->config = pci_ioremap ( utils->pci, pci_bar_start ( utils->pci, PCI_BASE_ADDRESS_0),
119 0x100000 );
120#endif
121 return status;
122}
uint8_t status
Status.
Definition ena.h:5
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
#define MLX_SUCCESS
int mlx_status
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
Definition pci.c:241
unsigned long pci_bar_start(struct pci_device *pci, unsigned int reg)
Find the start of a PCI BAR.
Definition pci.c:97
#define PCI_BASE_ADDRESS_0
Definition pci.h:63

References adjust_pci_device(), IN, MLX_SUCCESS, pci_bar_start(), PCI_BASE_ADDRESS_0, pci_ioremap(), and status.

Referenced by mlx_pci_init().

◆ mlx_pci_teardown_priv()

mlx_status mlx_pci_teardown_priv ( IN mlx_utils * utils)

Definition at line 125 of file mlx_pci_priv.c.

128{
130#ifdef DEVICE_CX3
131 iounmap( utils->config );
132#endif
133 return status;
134}
void iounmap(volatile const void *io_addr)
Unmap I/O address.

References __attribute__, IN, iounmap(), MLX_SUCCESS, status, and unused.

Referenced by mlx_pci_teardown().

◆ mlx_pci_read_priv()

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 )

Definition at line 137 of file mlx_pci_priv.c.

144{
146 status = mlx_pci_config(utils, TRUE, width, offset, count, buffer);
147 return status;
148}
uint16_t offset
Offset to command line.
Definition bzimage.h:3
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
static mlx_status mlx_pci_config(IN mlx_utils *utils, IN mlx_boolean read, IN mlx_pci_width width, IN mlx_uint32 offset, IN mlx_uintn count, IN OUT mlx_void *buffer)
#define TRUE
Definition tlan.h:46

References buffer, count, IN, mlx_pci_config(), MLX_SUCCESS, offset, OUT, status, and TRUE.

Referenced by mlx_pci_read().

◆ mlx_pci_write_priv()

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 )

Definition at line 151 of file mlx_pci_priv.c.

158{
160 status = mlx_pci_config(utils, FALSE, width, offset, count, buffer);
161 return status;
162}
#define FALSE
Definition tlan.h:45

References buffer, count, FALSE, IN, mlx_pci_config(), MLX_SUCCESS, offset, and status.

Referenced by mlx_pci_write().

◆ mlx_pci_mem_read_priv()

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 )

Definition at line 165 of file mlx_pci_priv.c.

173{
174 if (buffer == NULL || width != MlxPciWidthUint32)
176 *((mlx_uint32 *)buffer) = readl(offset);
177 return MLX_SUCCESS;
178}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
@ MlxPciWidthUint32
Definition mlx_pci.h:30
uint32_t mlx_uint32
#define MLX_INVALID_PARAMETER
#define readl
Definition w89c840.c:157

References __attribute__, buffer, count, IN, MLX_INVALID_PARAMETER, MLX_SUCCESS, MlxPciWidthUint32, NULL, offset, OUT, readl, and unused.

Referenced by mlx_pci_mem_read().

◆ mlx_pci_mem_write_priv()

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 )

Definition at line 181 of file mlx_pci_priv.c.

189{
190 if (buffer == NULL || width != MlxPciWidthUint32)
192 barrier();
194 return MLX_SUCCESS;
195}
#define barrier()
Optimisation barrier.
Definition compiler.h:633
#define writel
Definition w89c840.c:160

References __attribute__, barrier, buffer, count, IN, MLX_INVALID_PARAMETER, MLX_SUCCESS, MlxPciWidthUint32, NULL, offset, unused, and writel.

Referenced by mlx_pci_mem_write().