iPXE
Data Structures | Macros | Functions
io.h File Reference

iPXE I/O API More...

#include <stdint.h>
#include <ipxe/api.h>
#include <ipxe/iomap.h>
#include <config/ioapi.h>
#include <bits/io.h>

Go to the source code of this file.

Data Structures

struct  memory_region
 A usable memory region. More...
 
struct  memory_map
 A memory map. More...
 

Macros

#define PAGE_SIZE   ( 1 << PAGE_SHIFT )
 Page size. More...
 
#define PAGE_MASK   ( PAGE_SIZE - 1 )
 Page mask. More...
 
#define IOAPI_INLINE(_subsys, _api_func)   SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func )
 Calculate static inline I/O API function name. More...
 
#define PROVIDE_IOAPI(_subsys, _api_func, _func)   PROVIDE_SINGLE_API ( IOAPI_PREFIX_ ## _subsys, _api_func, _func )
 Provide an I/O API implementation. More...
 
#define PROVIDE_IOAPI_INLINE(_subsys, _api_func)   PROVIDE_SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func )
 Provide a static inline I/O API implementation. More...
 
#define IOAPI_READ(_func, _type, io_addr, _prefix, _ndigits)
 Wrap an I/O read. More...
 
#define IOAPI_WRITE(_func, _type, data, io_addr, _prefix, _ndigits)
 Wrap an I/O write. More...
 
#define IOAPI_READS(_func, _type, io_addr, data, count, _prefix, _ndigits)
 Wrap an I/O string read. More...
 
#define IOAPI_WRITES(_func, _type, io_addr, data, count, _prefix, _ndigits)
 Wrap an I/O string write. More...
 
#define readb(io_addr)   IOAPI_READ ( readb, uint8_t, io_addr, "MEM", 2 )
 
#define readw(io_addr)   IOAPI_READ ( readw, uint16_t, io_addr, "MEM", 4 )
 
#define readl(io_addr)   IOAPI_READ ( readl, uint32_t, io_addr, "MEM", 8 )
 
#define readq(io_addr)   IOAPI_READ ( readq, uint64_t, io_addr, "MEM", 16 )
 
#define writeb(data, io_addr)   IOAPI_WRITE ( writeb, uint8_t, data, io_addr, "MEM", 2 )
 
#define writew(data, io_addr)   IOAPI_WRITE ( writew, uint16_t, data, io_addr, "MEM", 4 )
 
#define writel(data, io_addr)   IOAPI_WRITE ( writel, uint32_t, data, io_addr, "MEM", 8 )
 
#define writeq(data, io_addr)   IOAPI_WRITE ( writeq, uint64_t, data, io_addr, "MEM", 16 )
 
#define inb(io_addr)   IOAPI_READ ( inb, uint8_t, io_addr, "IO", 2 )
 
#define inw(io_addr)   IOAPI_READ ( inw, uint16_t, io_addr, "IO", 4 )
 
#define inl(io_addr)   IOAPI_READ ( inl, uint32_t, io_addr, "IO", 8 )
 
#define outb(data, io_addr)   IOAPI_WRITE ( outb, uint8_t, data, io_addr, "IO", 2 )
 
#define outw(data, io_addr)   IOAPI_WRITE ( outw, uint16_t, data, io_addr, "IO", 4 )
 
#define outl(data, io_addr)   IOAPI_WRITE ( outl, uint32_t, data, io_addr, "IO", 8 )
 
#define insb(io_addr, data, count)   IOAPI_READS ( insb, uint8_t, io_addr, data, count, "IO", 2 )
 
#define insw(io_addr, data, count)   IOAPI_READS ( insw, uint16_t, io_addr, data, count, "IO", 4 )
 
#define insl(io_addr, data, count)   IOAPI_READS ( insl, uint32_t, io_addr, data, count, "IO", 8 )
 
#define outsb(io_addr, data, count)   IOAPI_WRITES ( outsb, uint8_t, io_addr, data, count, "IO", 2 )
 
#define outsw(io_addr, data, count)   IOAPI_WRITES ( outsw, uint16_t, io_addr, data, count, "IO", 4 )
 
#define outsl(io_addr, data, count)   IOAPI_WRITES ( outsl, uint32_t, io_addr, data, count, "IO", 8 )
 
#define INX_P(_func, _type, io_addr)
 Read value from I/O-mapped device, slowly. More...
 
#define inb_p(io_addr)   INX_P ( inb, uint8_t, io_addr )
 Read byte from I/O-mapped device. More...
 
#define inw_p(io_addr)   INX_P ( inw, uint16_t, io_addr )
 Read 16-bit word from I/O-mapped device. More...
 
#define inl_p(io_addr)   INX_P ( inl, uint32_t, io_addr )
 Read 32-bit dword from I/O-mapped device. More...
 
#define OUTX_P(_func, data, io_addr)
 Write value to I/O-mapped device, slowly. More...
 
#define outb_p(data, io_addr)   OUTX_P ( outb, data, io_addr )
 Write byte to I/O-mapped device, slowly. More...
 
#define outw_p(data, io_addr)   OUTX_P ( outw, data, io_addr )
 Write 16-bit word to I/O-mapped device, slowly. More...
 
#define outl_p(data, io_addr)   OUTX_P ( outl, data, io_addr )
 Write 32-bit dword to I/O-mapped device, slowly. More...
 
#define rmb()   mb()
 
#define wmb()   mb()
 
#define MAX_MEMORY_REGIONS   8
 Maximum number of memory regions we expect to encounter. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
unsigned long phys_to_bus (unsigned long phys_addr)
 Convert physical address to a bus address. More...
 
unsigned long bus_to_phys (unsigned long bus_addr)
 Convert bus address to a physical address. More...
 
static __always_inline unsigned long virt_to_bus (volatile const void *addr)
 Convert virtual address to a bus address. More...
 
static __always_inline void * bus_to_virt (unsigned long bus_addr)
 Convert bus address to a virtual address. More...
 
uint8_t readb (volatile uint8_t *io_addr)
 Read byte from memory-mapped device. More...
 
uint16_t readw (volatile uint16_t *io_addr)
 Read 16-bit word from memory-mapped device. More...
 
uint32_t readl (volatile uint32_t *io_addr)
 Read 32-bit dword from memory-mapped device. More...
 
uint64_t readq (volatile uint64_t *io_addr)
 Read 64-bit qword from memory-mapped device. More...
 
void writeb (uint8_t data, volatile uint8_t *io_addr)
 Write byte to memory-mapped device. More...
 
void writew (uint16_t data, volatile uint16_t *io_addr)
 Write 16-bit word to memory-mapped device. More...
 
void writel (uint32_t data, volatile uint32_t *io_addr)
 Write 32-bit dword to memory-mapped device. More...
 
void writeq (uint64_t data, volatile uint64_t *io_addr)
 Write 64-bit qword to memory-mapped device. More...
 
uint8_t inb (volatile uint8_t *io_addr)
 Read byte from I/O-mapped device. More...
 
uint16_t inw (volatile uint16_t *io_addr)
 Read 16-bit word from I/O-mapped device. More...
 
uint32_t inl (volatile uint32_t *io_addr)
 Read 32-bit dword from I/O-mapped device. More...
 
void outb (uint8_t data, volatile uint8_t *io_addr)
 Write byte to I/O-mapped device. More...
 
void outw (uint16_t data, volatile uint16_t *io_addr)
 Write 16-bit word to I/O-mapped device. More...
 
void outl (uint32_t data, volatile uint32_t *io_addr)
 Write 32-bit dword to I/O-mapped device. More...
 
void insb (volatile uint8_t *io_addr, uint8_t *data, unsigned int count)
 Read bytes from I/O-mapped device. More...
 
void insw (volatile uint16_t *io_addr, uint16_t *data, unsigned int count)
 Read 16-bit words from I/O-mapped device. More...
 
void insl (volatile uint32_t *io_addr, uint32_t *data, unsigned int count)
 Read 32-bit words from I/O-mapped device. More...
 
void outsb (volatile uint8_t *io_addr, const uint8_t *data, unsigned int count)
 Write bytes to I/O-mapped device. More...
 
void outsw (volatile uint16_t *io_addr, const uint16_t *data, unsigned int count)
 Write 16-bit words to I/O-mapped device. More...
 
void outsl (volatile uint32_t *io_addr, const uint32_t *data, unsigned int count)
 Write 32-bit words to I/O-mapped device. More...
 
void iodelay (void)
 Slow down I/O. More...
 
void mb (void)
 Memory barrier. More...
 
void get_memmap (struct memory_map *memmap)
 Get memory map. More...
 

Detailed Description

iPXE I/O API

The I/O API provides methods for reading from and writing to memory-mapped and I/O-mapped devices.

The standard methods (readl()/writel() etc.) do not strictly check the type of the address parameter; this is because traditional usage does not necessarily provide the correct pointer type. For example, code written for ISA devices at fixed I/O addresses (such as the keyboard controller) tend to use plain integer constants for the address parameter.

Definition in file io.h.

Macro Definition Documentation

◆ PAGE_SIZE

#define PAGE_SIZE   ( 1 << PAGE_SHIFT )

Page size.

Definition at line 27 of file io.h.

◆ PAGE_MASK

#define PAGE_MASK   ( PAGE_SIZE - 1 )

Page mask.

Definition at line 30 of file io.h.

◆ IOAPI_INLINE

#define IOAPI_INLINE (   _subsys,
  _api_func 
)    SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func )

Calculate static inline I/O API function name.

Parameters
_prefixSubsystem prefix
_api_funcAPI function
Return values
_subsys_funcSubsystem API function

Definition at line 39 of file io.h.

◆ PROVIDE_IOAPI

#define PROVIDE_IOAPI (   _subsys,
  _api_func,
  _func 
)    PROVIDE_SINGLE_API ( IOAPI_PREFIX_ ## _subsys, _api_func, _func )

Provide an I/O API implementation.

Parameters
_prefixSubsystem prefix
_api_funcAPI function
_funcImplementing function

Definition at line 49 of file io.h.

◆ PROVIDE_IOAPI_INLINE

#define PROVIDE_IOAPI_INLINE (   _subsys,
  _api_func 
)    PROVIDE_SINGLE_API_INLINE ( IOAPI_PREFIX_ ## _subsys, _api_func )

Provide a static inline I/O API implementation.

Parameters
_prefixSubsystem prefix
_api_funcAPI function

Definition at line 58 of file io.h.

◆ IOAPI_READ

#define IOAPI_READ (   _func,
  _type,
  io_addr,
  _prefix,
  _ndigits 
)
Value:
( { \
volatile _type *_io_addr = \
( ( volatile _type * ) ( intptr_t ) (io_addr) ); \
_type _data = _func ( _io_addr ); \
DBGIO ( "[" _prefix " %08lx] => %0" #_ndigits "llx\n", \
io_to_bus ( _io_addr ), ( unsigned long long ) _data ); \
_data; } )
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
unsigned long intptr_t
Definition: stdint.h:21

Wrap an I/O read.

Parameters
_funcI/O API function
_typeData type
io_addrI/O address
_prefixPrefix for address in debug message
_ndigitsNumber of hex digits for this data type

Definition at line 75 of file io.h.

◆ IOAPI_WRITE

#define IOAPI_WRITE (   _func,
  _type,
  data,
  io_addr,
  _prefix,
  _ndigits 
)
Value:
do { \
volatile _type *_io_addr = \
( ( volatile _type * ) ( intptr_t ) (io_addr) ); \
_type _data = (data); \
DBGIO ( "[" _prefix " %08lx] <= %0" #_ndigits "llx\n", \
io_to_bus ( _io_addr ), ( unsigned long long ) _data ); \
_func ( _data, _io_addr ); \
} while ( 0 )
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
unsigned long intptr_t
Definition: stdint.h:21
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

Wrap an I/O write.

Parameters
_funcI/O API function
_typeData type
dataValue to write
io_addrI/O address
_prefixPrefix for address in debug message
_ndigitsNumber of hex digits for this data type

Definition at line 93 of file io.h.

◆ IOAPI_READS

#define IOAPI_READS (   _func,
  _type,
  io_addr,
  data,
  count,
  _prefix,
  _ndigits 
)
Value:
do { \
volatile _type *_io_addr = \
( ( volatile _type * ) ( intptr_t ) (io_addr) ); \
void *_data_void = (data); /* Check data is a pointer */ \
_type * _data = ( ( _type * ) _data_void ); \
const _type * _dbg_data = _data; \
unsigned int _count = (count); \
unsigned int _dbg_count = _count; \
_func ( _io_addr, _data, _count ); \
DBGIO ( "[" _prefix " %08lx] =>", io_to_bus ( _io_addr ) ); \
while ( _dbg_count-- ) { \
DBGIO ( " %0" #_ndigits "llx", \
( ( unsigned long long ) *(_dbg_data++) ) ); \
} \
DBGIO ( "\n" ); \
} while ( 0 )
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
unsigned long intptr_t
Definition: stdint.h:21
uint16_t count
Number of entries.
Definition: ena.h:22
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

Wrap an I/O string read.

Parameters
_funcI/O API function
_typeData type
io_addrI/O address
dataData buffer
countNumber of elements to read
_prefixPrefix for address in debug message
_ndigitsNumber of hex digits for this data type

Definition at line 113 of file io.h.

◆ IOAPI_WRITES

#define IOAPI_WRITES (   _func,
  _type,
  io_addr,
  data,
  count,
  _prefix,
  _ndigits 
)
Value:
do { \
volatile _type *_io_addr = \
( ( volatile _type * ) ( intptr_t ) (io_addr) ); \
const void *_data_void = (data); /* Check data is a pointer */ \
const _type * _data = ( ( const _type * ) _data_void ); \
const _type * _dbg_data = _data; \
unsigned int _count = (count); \
unsigned int _dbg_count = _count; \
DBGIO ( "[" _prefix " %08lx] <=", io_to_bus ( _io_addr ) ); \
while ( _dbg_count-- ) { \
DBGIO ( " %0" #_ndigits "llx", \
( ( unsigned long long ) *(_dbg_data++) ) ); \
} \
DBGIO ( "\n" ); \
_func ( _io_addr, _data, _count ); \
} while ( 0 )
unsigned long io_to_bus(volatile const void *io_addr)
Convert I/O address to bus address (for debug only)
unsigned long intptr_t
Definition: stdint.h:21
uint16_t count
Number of entries.
Definition: ena.h:22
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

Wrap an I/O string write.

Parameters
_funcI/O API function
_typeData type
io_addrI/O address
dataData buffer
countNumber of elements to write
_prefixPrefix for address in debug message
_ndigitsNumber of hex digits for this data type

Definition at line 142 of file io.h.

◆ readb

#define readb (   io_addr)    IOAPI_READ ( readb, uint8_t, io_addr, "MEM", 2 )

Definition at line 206 of file io.h.

◆ readw

#define readw (   io_addr)    IOAPI_READ ( readw, uint16_t, io_addr, "MEM", 4 )

Definition at line 215 of file io.h.

◆ readl

#define readl (   io_addr)    IOAPI_READ ( readl, uint32_t, io_addr, "MEM", 8 )

Definition at line 224 of file io.h.

◆ readq

#define readq (   io_addr)    IOAPI_READ ( readq, uint64_t, io_addr, "MEM", 16 )

Definition at line 233 of file io.h.

◆ writeb

#define writeb (   data,
  io_addr 
)    IOAPI_WRITE ( writeb, uint8_t, data, io_addr, "MEM", 2 )

Definition at line 242 of file io.h.

◆ writew

#define writew (   data,
  io_addr 
)    IOAPI_WRITE ( writew, uint16_t, data, io_addr, "MEM", 4 )

Definition at line 252 of file io.h.

◆ writel

#define writel (   data,
  io_addr 
)    IOAPI_WRITE ( writel, uint32_t, data, io_addr, "MEM", 8 )

Definition at line 262 of file io.h.

◆ writeq

#define writeq (   data,
  io_addr 
)    IOAPI_WRITE ( writeq, uint64_t, data, io_addr, "MEM", 16 )

Definition at line 272 of file io.h.

◆ inb

#define inb (   io_addr)    IOAPI_READ ( inb, uint8_t, io_addr, "IO", 2 )

Definition at line 282 of file io.h.

◆ inw

#define inw (   io_addr)    IOAPI_READ ( inw, uint16_t, io_addr, "IO", 4 )

Definition at line 291 of file io.h.

◆ inl

#define inl (   io_addr)    IOAPI_READ ( inl, uint32_t, io_addr, "IO", 8 )

Definition at line 300 of file io.h.

◆ outb

#define outb (   data,
  io_addr 
)    IOAPI_WRITE ( outb, uint8_t, data, io_addr, "IO", 2 )

Definition at line 309 of file io.h.

◆ outw

#define outw (   data,
  io_addr 
)    IOAPI_WRITE ( outw, uint16_t, data, io_addr, "IO", 4 )

Definition at line 319 of file io.h.

◆ outl

#define outl (   data,
  io_addr 
)    IOAPI_WRITE ( outl, uint32_t, data, io_addr, "IO", 8 )

Definition at line 329 of file io.h.

◆ insb

#define insb (   io_addr,
  data,
  count 
)    IOAPI_READS ( insb, uint8_t, io_addr, data, count, "IO", 2 )

Definition at line 340 of file io.h.

◆ insw

#define insw (   io_addr,
  data,
  count 
)    IOAPI_READS ( insw, uint16_t, io_addr, data, count, "IO", 4 )

Definition at line 351 of file io.h.

◆ insl

#define insl (   io_addr,
  data,
  count 
)    IOAPI_READS ( insl, uint32_t, io_addr, data, count, "IO", 8 )

Definition at line 362 of file io.h.

◆ outsb

#define outsb (   io_addr,
  data,
  count 
)    IOAPI_WRITES ( outsb, uint8_t, io_addr, data, count, "IO", 2 )

Definition at line 374 of file io.h.

◆ outsw

#define outsw (   io_addr,
  data,
  count 
)    IOAPI_WRITES ( outsw, uint16_t, io_addr, data, count, "IO", 4 )

Definition at line 386 of file io.h.

◆ outsl

#define outsl (   io_addr,
  data,
  count 
)    IOAPI_WRITES ( outsl, uint32_t, io_addr, data, count, "IO", 8 )

Definition at line 398 of file io.h.

◆ INX_P

#define INX_P (   _func,
  _type,
  io_addr 
)
Value:
( { \
_type _data = _func ( (io_addr) ); \
iodelay(); \
_data; } )

Read value from I/O-mapped device, slowly.

Parameters
_funcFunction to use to read value
dataValue to write
io_addrI/O address

Definition at line 414 of file io.h.

◆ inb_p

#define inb_p (   io_addr)    INX_P ( inb, uint8_t, io_addr )

Read byte from I/O-mapped device.

Parameters
io_addrI/O address
Return values
dataValue read

Definition at line 425 of file io.h.

◆ inw_p

#define inw_p (   io_addr)    INX_P ( inw, uint16_t, io_addr )

Read 16-bit word from I/O-mapped device.

Parameters
io_addrI/O address
Return values
dataValue read

Definition at line 433 of file io.h.

◆ inl_p

#define inl_p (   io_addr)    INX_P ( inl, uint32_t, io_addr )

Read 32-bit dword from I/O-mapped device.

Parameters
io_addrI/O address
Return values
dataValue read

Definition at line 441 of file io.h.

◆ OUTX_P

#define OUTX_P (   _func,
  data,
  io_addr 
)
Value:
do { \
_func ( (data), (io_addr) ); \
iodelay(); \
} while ( 0 )
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12

Write value to I/O-mapped device, slowly.

Parameters
_funcFunction to use to write value
dataValue to write
io_addrI/O address

Definition at line 450 of file io.h.

◆ outb_p

#define outb_p (   data,
  io_addr 
)    OUTX_P ( outb, data, io_addr )

Write byte to I/O-mapped device, slowly.

Parameters
dataValue to write
io_addrI/O address

Definition at line 461 of file io.h.

◆ outw_p

#define outw_p (   data,
  io_addr 
)    OUTX_P ( outw, data, io_addr )

Write 16-bit word to I/O-mapped device, slowly.

Parameters
dataValue to write
io_addrI/O address

Definition at line 469 of file io.h.

◆ outl_p

#define outl_p (   data,
  io_addr 
)    OUTX_P ( outl, data, io_addr )

Write 32-bit dword to I/O-mapped device, slowly.

Parameters
dataValue to write
io_addrI/O address

Definition at line 477 of file io.h.

◆ rmb

#define rmb ( )    mb()

Definition at line 484 of file io.h.

◆ wmb

wmb ( )    mb()

Definition at line 485 of file io.h.

◆ MAX_MEMORY_REGIONS

#define MAX_MEMORY_REGIONS   8

Maximum number of memory regions we expect to encounter.

Definition at line 496 of file io.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ phys_to_bus()

unsigned long phys_to_bus ( unsigned long  phys_addr)

Convert physical address to a bus address.

Parameters
phys_addrPhysical address
Return values
bus_addrBus address

Referenced by exanic_open(), and virt_to_bus().

◆ bus_to_phys()

unsigned long bus_to_phys ( unsigned long  bus_addr)

Convert bus address to a physical address.

Parameters
bus_addrBus address
Return values
phys_addrPhysical address

Referenced by bus_to_virt().

◆ virt_to_bus()

static __always_inline unsigned long virt_to_bus ( volatile const void *  addr)
inlinestatic

Convert virtual address to a bus address.

Parameters
addrVirtual address
Return values
bus_addrBus address

Definition at line 183 of file io.h.

183  {
184  return phys_to_bus ( virt_to_phys ( addr ) );
185 }
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Definition: uaccess.h:287
u32 addr
Definition: sky2.h:8
unsigned long phys_to_bus(unsigned long phys_addr)
Convert physical address to a bus address.

References addr, phys_to_bus(), and virt_to_phys().

Referenced by __vxge_hw_vpath_prc_configure(), a3c90x_open(), a3c90x_prepare_rx_desc(), a3c90x_process_tx_packets(), a3c90x_setup_rx_ring(), a3c90x_transmit(), amd8111e_init_rx_ring(), amd8111e_poll(), amd8111e_start(), amd8111e_transmit(), arbel_cmd(), arbel_complete(), arbel_create_cq(), arbel_create_qp(), arbel_create_recv_wq(), arbel_create_send_wq(), arbel_fill_mlx_send_wqe(), arbel_fill_rc_send_wqe(), arbel_fill_ud_send_wqe(), arbel_post_recv(), ath5k_desc_alloc(), ath5k_rx_iob_alloc(), ath5k_txbuf_setup(), ath_descdma_setup(), ath_rx_init(), ath_rx_tasklet(), ath_tx_setup_buffer(), atl1e_setup_ring_resources(), atl1e_tx_map(), b44_address_ok(), bnx2_alloc_mem(), bnx2_init_rx_ring(), bnx2_transmit(), davicom_init_chain(), davicom_reset(), dmfe_descriptor_init(), efx_hunt_alloc_special_buffer(), efx_hunt_build_rx_desc(), efx_hunt_build_tx_desc(), ena_create_cq(), ena_create_sq(), ena_refill_rx(), ena_set_base(), ena_transmit(), epic100_init_ring(), exanic_probe(), falcon_alloc_special_buffer(), falcon_build_rx_desc(), falcon_build_tx_desc(), falcon_init_resources(), flexboot_nodnic_post_recv(), forcedeth_transmit(), golan_cmd_init(), hermon_cmd(), hermon_fill_eth_send_wqe(), hermon_fill_mlx_send_wqe(), hermon_fill_rc_send_wqe(), hermon_fill_ud_send_wqe(), hermon_post_recv(), hunt_mcdi_copyin(), icplus_create_ring(), icplus_refill_rx(), icplus_set_base(), icplus_transmit(), ifec_net_open(), ifec_net_transmit(), ifec_refill_rx_ring(), ifec_reprime_ru(), ifec_tx_setup(), ifec_tx_wake(), igbvf_configure_rx(), igbvf_configure_tx(), igbvf_process_tx_packets(), igbvf_refill_rx_ring(), igbvf_setup_rx_resources(), igbvf_setup_tx_resources(), igbvf_transmit(), init_ring(), intel_create_ring(), intel_refill_rx(), intel_transmit(), intelxl_admin_command(), intelxl_admin_event_init(), intelxl_alloc_admin(), intelxl_alloc_ring(), intelxl_create_ring(), intelxl_enable_admin(), intelxl_msix_enable(), intelxl_refill_rx(), intelxl_transmit(), intelxlvf_admin_configure(), intelxlvf_admin_event(), jme_alloc_rx_resources(), jme_alloc_tx_resources(), jme_fill_tx_desc(), jme_set_clean_rxdesc(), jme_tx_clean(), linda_create_recv_wq(), linda_init_send(), linda_post_recv(), mlx_memory_map_dma_priv(), myri10ge_command(), myri10ge_net_open(), myri10ge_net_transmit(), myri10ge_post_receive(), myson_create_ring(), myson_refill_rx(), myson_transmit(), natsemi_create_ring(), natsemi_refill_rx(), natsemi_transmit(), nii_poll_rx(), nii_transmit(), nv_alloc_rx(), nv_init_rings(), pcnet32_open(), pcnet32_process_rx_packets(), pcnet32_process_tx_packets(), pcnet32_refill_rx_ring(), pcnet32_setup_init_block(), pcnet32_setup_rx_resources(), pcnet32_setup_tx_resources(), pcnet32_transmit(), phantom_create_rx_ctx(), phantom_create_tx_ctx(), phantom_issue_buf_cmd(), phantom_poll(), phantom_post_cds(), phantom_post_rds(), phantom_refill_rx_ring(), phantom_transmit(), qib7322_create_recv_wq(), qib7322_init_send(), qib7322_post_recv(), realtek_create_buffer(), realtek_create_ring(), realtek_refill_rx(), realtek_transmit(), rhine_create_ring(), rhine_refill_rx(), rhine_transmit(), rtl818x_handle_rx(), rtl818x_init_rx_ring(), rtl818x_init_tx_ring(), rtl818x_tx(), shomron_fill_eth_send_wqe(), sis190_alloc_rx_iob(), sis190_open(), sis190_transmit(), sis900_init_rxd(), sis900_init_txd(), sis900_poll(), sis900_transmit(), skge_rx_setup(), skge_up(), skge_xmit_frame(), sky2_probe(), sky2_rx_map_iob(), sky2_up(), sky2_xmit_frame(), tg3_alloc_consistent(), tg3_alloc_rx_iob(), tg3_test_dma(), tg3_transmit(), TLan_FinishReset(), TLan_ResetLists(), txnic_refill_rq(), txnic_send(), velocity_alloc_rings(), vmxnet3_open(), vmxnet3_refill_rx(), vmxnet3_transmit(), vxge_hw_fifo_txdl_buffer_set(), vxge_hw_fifo_txdl_post(), vxge_hw_ring_replenish(), vxge_hw_ring_rxd_1b_set(), and w89c840_reset().

◆ bus_to_virt()

static __always_inline void* bus_to_virt ( unsigned long  bus_addr)
inlinestatic

Convert bus address to a virtual address.

Parameters
bus_addrBus address
Return values
addrVirtual address

This operation is not available under all memory models.

Definition at line 195 of file io.h.

195  {
196  return phys_to_virt ( bus_to_phys ( bus_addr ) );
197 }
static __always_inline void * phys_to_virt(unsigned long phys_addr)
Convert physical address to a virtual address.
Definition: uaccess.h:299
unsigned long bus_to_phys(unsigned long bus_addr)
Convert bus address to a physical address.

References bus_to_phys(), and phys_to_virt().

Referenced by atl1e_probe(), bnx2_poll(), eth_probe(), ne_poll(), ns8390_poll(), ns8390_transmit(), and prism2_find_plx().

◆ readb()

uint8_t readb ( volatile uint8_t io_addr)

◆ readw()

uint16_t readw ( volatile uint16_t io_addr)

◆ readl()

uint32_t readl ( volatile uint32_t io_addr)

Read 32-bit dword from memory-mapped device.

Parameters
io_addrI/O address
Return values
dataValue read

Referenced by __er32(), _efx_readl(), amd8111e_disable_interrupt(), amd8111e_enable_interrupt(), amd8111e_force_interrupt(), amd8111e_init_hw_default(), amd8111e_poll(), amd8111e_poll_link(), amd8111e_read_phy(), amd8111e_start(), amd8111e_transmit(), amd8111e_wait_link(), arbel_cmd(), arbel_cmd_wait(), ath5k_hw_reg_read(), ath9k_ioread32(), ath9k_reg_rmw(), bflush(), br32(), cmdif_rev(), ehci_async_del(), ehci_bus_poll(), ehci_dump(), ehci_init(), ehci_reset(), ehci_root_disable(), ehci_root_enable(), ehci_root_open(), ehci_root_poll(), ehci_root_speed(), ehci_run(), ehci_stop(), ena_reset(), exanic_check_link(), exanic_i2c_read_bit(), exanic_i2c_write_bit(), exanic_probe(), exanic_probe_port(), forcedeth_link_status(), forcedeth_open(), forcedeth_poll(), fw_rev_maj(), fw_rev_min(), fw_rev_sub(), golan_cmd_init(), hermon_cmd(), hermon_cmd_wait(), hvm_map_shared_info(), icplus_init_phy(), icplus_poll(), icplus_reset(), intel_check_link(), intel_create_ring(), intel_disable_ring(), intel_fetch_mac(), intel_init_eeprom(), intel_open(), intel_poll(), intel_read_eeprom(), intel_reset(), intelvf_mbox_msg(), intelvf_mbox_poll(), intelvf_mbox_read(), intelx_check_link(), intelx_close(), intelx_open(), intelx_poll(), intelx_reset(), intelx_try_fetch_mac(), intelxl_admin_clear_pxe(), intelxl_context_dump(), intelxl_context_line(), intelxl_disable_ring(), intelxl_enable_ring(), intelxl_fetch_mac(), intelxl_probe(), intelxl_reset(), intelxlvf_reset_wait_active(), intelxlvf_reset_wait_teardown(), intelxvf_check_link(), intelxvf_open(), intelxvf_poll(), intelxvf_stats(), jread32(), jwrite32f(), mii_rw(), mlx_pci_mem_read_priv(), myson_poll(), myson_probe(), myson_reload_config(), myson_soft_reset(), myson_wait_idle(), natsemi_check_link(), natsemi_pmatch(), natsemi_poll(), natsemi_reload_config(), natsemi_reset(), natsemi_soft_reset(), natsemi_spi_read_bit(), natsemi_spi_write_bit(), nv_mac_reset(), nv_mgmt_acquire_sema(), nv_mgmt_get_version(), nv_mgmt_release_sema(), nv_setup_mac_addr(), nv_setup_phy(), nv_start_rx(), nv_start_tx(), nv_stop_rx(), nv_stop_tx(), nv_txrx_gate(), nv_update_linkspeed(), nv_update_pause(), pci_msix_control(), pci_msix_dump(), pci_push(), phantom_crb_access_128m(), phantom_crb_access_2m(), phantom_crb_access_32m(), phantom_readl(), phy_init(), realtek_init_eeprom(), realtek_mii_read(), realtek_mii_write(), realtek_open(), realtek_poll_tx(), reg_delay(), skge_read32(), sky2_read32(), tg3_get_invariants(), tg3_read32_mbox_5906(), vmxnet3_check_version(), vmxnet3_command(), xenstore_recv(), xenstore_send(), xhci_abort(), xhci_command_free(), xhci_dump(), xhci_dump_port(), xhci_extended_capability(), xhci_init(), xhci_legacy_claim(), xhci_port_protocol(), xhci_port_psiv(), xhci_port_slot_type(), xhci_port_speed(), xhci_port_status(), xhci_reset(), xhci_root_disable(), xhci_root_enable(), xhci_root_open(), xhci_root_speed(), xhci_run(), xhci_stop(), and xhci_supported_protocol().

◆ readq()

uint64_t readq ( volatile uint64_t io_addr)

◆ writeb()

void writeb ( uint8_t  data,
volatile uint8_t io_addr 
)

◆ writew()

void writew ( uint16_t  data,
volatile uint16_t io_addr 
)

Write 16-bit word to memory-mapped device.

Parameters
dataValue to write
io_addrI/O address

◆ writel()

void writel ( uint32_t  data,
volatile uint32_t io_addr 
)

Write 32-bit dword to memory-mapped device.

Parameters
dataValue to write
io_addrI/O address

Referenced by __ew32(), __vxge_hw_pio_mem_write32_lower(), __vxge_hw_pio_mem_write32_upper(), _efx_writel(), amd8111e_disable_interrupt(), amd8111e_enable_interrupt(), amd8111e_force_interrupt(), amd8111e_init_hw_default(), amd8111e_poll(), amd8111e_read_phy(), amd8111e_start(), amd8111e_transmit(), arbel_cmd(), arbel_poll_eq(), arbel_reset(), arbel_ring_doorbell(), ath5k_hw_reg_write(), ath9k_iowrite32(), ath9k_reg_rmw(), bw32(), ehci_async_del(), ehci_bus_open(), ehci_bus_poll(), ehci_reset(), ehci_root_close(), ehci_root_disable(), ehci_root_enable(), ehci_root_open(), ehci_root_poll(), ehci_root_speed(), ehci_run(), ehci_stop(), ena_admin(), ena_clear_caps(), ena_refill_rx(), ena_reset(), ena_set_base(), ena_set_caps(), ena_transmit(), exanic_clear_base(), exanic_close(), exanic_expired(), exanic_i2c_write_bit(), exanic_open(), exanic_probe(), exanic_reset(), exanic_transmit(), exanic_write_base(), forcedeth_link_status(), forcedeth_open(), forcedeth_poll(), forcedeth_probe(), forcedeth_transmit(), golan_cmd_init(), golan_eq_update_ci(), hermon_cmd(), hermon_poll_eq(), hermon_post_send(), hermon_reset(), icplus_open(), icplus_reset(), icplus_set_base(), if(), intel_close(), intel_create_ring(), intel_disable_ring(), intel_init_eeprom(), intel_irq(), intel_open(), intel_read_eeprom(), intel_refill_rx(), intel_reset(), intel_reset_ring(), intel_transmit(), intelvf_mbox_msg(), intelvf_mbox_poll(), intelvf_mbox_write(), intelx_close(), intelx_irq(), intelx_open(), intelx_reset(), intelxl_admin_command(), intelxl_alloc_ring(), intelxl_close(), intelxl_context_dump(), intelxl_context_line(), intelxl_disable_admin(), intelxl_disable_ring(), intelxl_enable_admin(), intelxl_enable_ring(), intelxl_open(), intelxl_poll(), intelxl_probe(), intelxl_refill_admin(), intelxl_refill_rx(), intelxl_reset(), intelxl_transmit(), intelxvf_irq(), intelxvf_open(), intelxvf_reset(), jwrite32(), jwrite32f(), linda_writel(), mii_rw(), mlx_pci_mem_write_priv(), myson_close(), myson_create_ring(), myson_destroy_ring(), myson_irq(), myson_open(), myson_poll(), myson_refill_rx(), myson_reload_config(), myson_reset(), myson_soft_reset(), myson_transmit(), natsemi_check_link(), natsemi_close(), natsemi_create_ring(), natsemi_destroy_ring(), natsemi_irq(), natsemi_open(), natsemi_pmatch(), natsemi_refill_rx(), natsemi_reload_config(), natsemi_reset(), natsemi_soft_reset(), natsemi_spi_write_bit(), natsemi_transmit(), nv_disable_hw_interrupts(), nv_enable_hw_interrupts(), nv_init_rings(), nv_mac_reset(), nv_mgmt_acquire_sema(), nv_mgmt_get_version(), nv_mgmt_release_sema(), nv_setup_phy(), nv_start_rx(), nv_start_tx(), nv_stop_rx(), nv_stop_tx(), nv_txrx_gate(), nv_txrx_reset(), nv_update_linkspeed(), nv_update_pause(), pci_msix_control(), pci_msix_map(), phantom_crb_access_128m(), phantom_crb_access_2m(), phantom_crb_access_32m(), phantom_writel(), phy_init(), qib7322_writel(), realtek_create_buffer(), realtek_create_ring(), realtek_destroy_buffer(), realtek_destroy_ring(), realtek_mii_read(), realtek_mii_write(), realtek_open(), realtek_transmit(), rhine_create_ring(), rhine_destroy_ring(), send_command(), skge_write32(), sky2_write32(), tg3_get_invariants(), tg3_write32_mbox_5906(), velocity_alloc_rings(), velocity_close(), vmxnet3_check_version(), vmxnet3_command(), vmxnet3_open(), vmxnet3_poll_events(), vmxnet3_refill_rx(), vmxnet3_set_ll_addr(), vmxnet3_transmit(), vpm_iowrite32(), xengrant_zero(), xenstore_recv(), xenstore_send(), xhci_doorbell(), xhci_event_alloc(), xhci_event_free(), xhci_legacy_claim(), xhci_port_status(), xhci_reset(), xhci_root_disable(), xhci_root_enable(), xhci_root_open(), xhci_root_speed(), xhci_run(), xhci_stop(), and xhci_writeq().

◆ writeq()

void writeq ( uint64_t  data,
volatile uint64_t io_addr 
)

◆ inb()

uint8_t inb ( volatile uint8_t io_addr)

◆ inw()

uint16_t inw ( volatile uint16_t io_addr)

◆ inl()

uint32_t inl ( volatile uint32_t io_addr)

◆ outb()

void outb ( uint8_t  data,
volatile uint8_t io_addr 
)

Write byte to I/O-mapped device.

Parameters
dataValue to write
io_addrI/O address

◆ outw()

void outw ( uint16_t  data,
volatile uint16_t io_addr 
)

Write 16-bit word to I/O-mapped device.

Parameters
dataValue to write
io_addrI/O address

◆ outl()

void outl ( uint32_t  data,
volatile uint32_t io_addr 
)

Write 32-bit dword to I/O-mapped device.

Parameters
dataValue to write
io_addrI/O address

◆ insb()

void insb ( volatile uint8_t io_addr,
uint8_t data,
unsigned int  count 
)

Read bytes from I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of bytes to read

Referenced by pnic_command_quiet().

◆ insw()

void insw ( volatile uint16_t io_addr,
uint16_t data,
unsigned int  count 
)

Read 16-bit words from I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of words to read

Referenced by cs89x0_poll(), eepro_poll(), smc9000_poll(), t509_poll(), t515_poll(), and t595_poll().

◆ insl()

void insl ( volatile uint32_t io_addr,
uint32_t data,
unsigned int  count 
)

Read 32-bit words from I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of words to read

◆ outsb()

void outsb ( volatile uint8_t io_addr,
const uint8_t data,
unsigned int  count 
)

Write bytes to I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of bytes to write

Referenced by pnic_command_quiet().

◆ outsw()

void outsw ( volatile uint16_t io_addr,
const uint16_t data,
unsigned int  count 
)

Write 16-bit words to I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of words to write

Referenced by cs89x0_transmit(), eepro_transmit(), send_test_pkt(), smc9000_transmit(), t509_transmit(), t515_transmit(), and t595_transmit().

◆ outsl()

void outsl ( volatile uint32_t io_addr,
const uint32_t data,
unsigned int  count 
)

Write 32-bit words to I/O-mapped device.

Parameters
io_addrI/O address
dataData buffer
countNumber of words to write

◆ iodelay()

void iodelay ( void  )

Slow down I/O.

Referenced by myson_poll().

◆ mb()

void mb ( void  )

◆ get_memmap()

void get_memmap ( struct memory_map memmap)