Loading...
Searching...
No Matches
IO interface

## Typedefs

typedef l4vbus_resource_t | l4io_resource_t
| Resource descriptor.
typedef l4vbus_device_t | l4io_device_t
| Device descriptor.

## Enumerations

enum | l4io_iomem_flags_t { L4IO_MEM_NONCACHED = 0 , L4IO_MEM_CACHED = 1 , L4IO_MEM_USE_MTRR = 2 , L4IO_MEM_ATTR_MASK = 0xf , L4IO_MEM_WRITE_COMBINED = L4IO_MEM_USE_MTRR | L4IO_MEM_CACHED , L4IO_MEM_USE_RESERVED_AREA = 0x40 << 8 , L4IO_MEM_EAGER_MAP = 0x80 << 8 }
| Flags for IO memory. More...
enum | l4io_device_types_t { L4IO_DEVICE_INVALID = 0 , L4IO_DEVICE_PCI , L4IO_DEVICE_USB , L4IO_DEVICE_OTHER , L4IO_DEVICE_ANY = ~0 }
| Device types. More...
enum | l4io_resource_types_t { L4IO_RESOURCE_INVALID = L4VBUS_RESOURCE_INVALID , L4IO_RESOURCE_IRQ = L4VBUS_RESOURCE_IRQ , L4IO_RESOURCE_MEM = L4VBUS_RESOURCE_MEM , L4IO_RESOURCE_PORT = L4VBUS_RESOURCE_PORT , L4IO_RESOURCE_ANY = ~0 }
| Resource types. More...

## Functions

long | l4io_request_iomem (l4_addr_t phys, unsigned long size, int flags, l4_addr_t *virt)
| Request an IO memory region.
long | l4io_request_iomem_region (l4_addr_t phys, l4_addr_t virt, unsigned long size, int flags)
| Request an IO memory region and map it to a specified region.
long | l4io_release_iomem (l4_addr_t virt, unsigned long size)
| Release an IO memory region.
long | l4io_request_ioport (unsigned portnum, unsigned len)
| Request an IO port region.
long | l4io_release_ioport (unsigned portnum, unsigned len)
| Release an IO port region.
int | l4io_lookup_device (const char *devname, l4io_device_handle_t *dev_handle, l4io_device_t *dev, l4io_resource_handle_t *res_handle)
| Find a device by name.
int | l4io_lookup_resource (l4io_device_handle_t devhandle, enum l4io_resource_types_t type, l4io_resource_handle_t *reshandle, l4io_resource_t *res)
| Request a specific resource from a device description.
l4_addr_t | l4io_request_resource_iomem (l4io_device_handle_t devhandle, l4io_resource_handle_t *reshandle)
| Request IO memory.
int | l4io_has_resource (enum l4io_resource_types_t type, l4vbus_paddr_t start, l4vbus_paddr_t end)
| Check if a resource is available.

## Detailed Description

## Typedef Documentation

## l4io_resource_t

typedef l4vbus_resource_t l4io_resource_t

Resource descriptor.

For IRQ types, the end field is not used, i.e. only a single interrupt can be described with a l4io_resource_t

Definition at line 67 of file types.h.

## Enumeration Type Documentation

## l4io_device_types_t

enum l4io_device_types_t

Device types.

Enumerator
L4IO_DEVICE_INVALID | Invalid type.
L4IO_DEVICE_PCI | PCI device.
L4IO_DEVICE_USB | USB device.
L4IO_DEVICE_OTHER | Any other device without unique IDs.
L4IO_DEVICE_ANY | any type

Definition at line 36 of file types.h.

## l4io_iomem_flags_t

enum l4io_iomem_flags_t

Flags for IO memory.

Enumerator
L4IO_MEM_NONCACHED | Non-cache memory.
L4IO_MEM_CACHED | Cache memory.
L4IO_MEM_USE_MTRR | Use MTRR.
L4IO_MEM_USE_RESERVED_AREA | Use reserved area for mapping I/O memory. Flag only valid for l4io_request_iomem_region()
L4IO_MEM_EAGER_MAP | Eagerly map the I/O memory. Passthrough to the l4re-rm.

Definition at line 14 of file types.h.

## l4io_resource_types_t

enum l4io_resource_types_t

Resource types.

Enumerator
L4IO_RESOURCE_INVALID | Invalid type.
L4IO_RESOURCE_IRQ | Interrupt resource.
L4IO_RESOURCE_MEM | I/O memory resource.
L4IO_RESOURCE_PORT | I/O port resource (x86 only).
L4IO_RESOURCE_ANY | any type

Definition at line 48 of file types.h.

## Function Documentation

## l4io_has_resource()

int l4io_has_resource | ( | enum l4io_resource_types_t | type,
|  | l4vbus_paddr_t | start,
|  | l4vbus_paddr_t | end )

Check if a resource is available.

Parameters

  type | Type of resource
  start | Minimal value.
  end | Maximum value.

References L4_INLINE.

## l4io_lookup_device()

int l4io_lookup_device | ( | const char * | devname,
|  | l4io_device_handle_t * | dev_handle,
|  | l4io_device_t * | dev,
|  | l4io_resource_handle_t * | res_handle )

Find a device by name.

Parameters

  | devname | Name of device.
  [out] | dev_handle | Device handle for found device, can be NULL.
  [out] | dev | Device information, filled by the function, can be NULL.
  [out] | res_handle | Resource handle, can be NULL.

Returns
  0 on success, error code otherwise

References L4_CV, and L4_EXPORT.

## l4io_lookup_resource()

int l4io_lookup_resource | ( | l4io_device_handle_t | devhandle,
|  | enum l4io_resource_types_t | type,
|  | l4io_resource_handle_t * | reshandle,
|  | l4io_resource_t * | res )

Request a specific resource from a device description.

Parameters

  | devhandle | Device handle.
  | type | Type of resource to request (see l4io_resource_types_t).
  [in,out] | reshandle | Resource handle, start with handle returned by device functions. The next resource handle is returned here.
  [out] | res | Device descriptor.

Returns
  0 on success, error code otherwise, esp. -L4_ENOENT if no more resources found

References L4_CV, and L4_EXPORT.

## l4io_release_iomem()

long l4io_release_iomem | ( | l4_addr_t | virt,
|  | unsigned long | size )

Release an IO memory region.

Parameters

  virt | Virtual address of region to free, see l4io_request_iomem
  size | Size of the region to release.

Returns
  0 on success, <0 on error

References L4_CV, and L4_EXPORT.

## l4io_release_ioport()

long l4io_release_ioport | ( | unsigned | portnum,
|  | unsigned | len )

Release an IO port region.

Parameters

  portnum | Start of port range to release
  len | Length of range to request

Returns
  0 on success, <0 on error

Note
  X86 architecture only

References L4_CV, L4_EXPORT, and L4_INLINE.

## l4io_request_iomem()

long l4io_request_iomem | ( | l4_addr_t | phys,
|  | unsigned long | size,
|  | int | flags,
|  | l4_addr_t * | virt )

Request an IO memory region.

Parameters

  | phys | Physical address of the I/O memory region
  | size | Size of the region in Bytes, granularity pages.
  | flags | See l4io_iomem_flags_t
  [in,out] | virt | Virtual address where the IO memory region should be mapped to. If the caller passes '0' a region in the caller's address space is searched and the virtual address is returned.

Return values

  0 | Success.
  -L4_ENOENT | No area in the caller's address space could be found to map the IO memory region.
  -L4_EPERM | Operation not allowed.
  -L4_EINVAL | Invalid value.
  -L4_EADDRNOTAVAIL | The requested virtual address is not available.
  -L4_ENOMEM | The requested IO memory region could not be allocated.
  <0 | IPC errors.

Note
  This function uses L4Re functionality to reserve a part of the virtual address space of the caller.

References L4_CV, and L4_EXPORT.

## l4io_request_iomem_region()

long l4io_request_iomem_region | ( | l4_addr_t | phys,
|  | l4_addr_t | virt,
|  | unsigned long | size,
|  | int | flags )

Request an IO memory region and map it to a specified region.

Parameters

  phys | Physical address of the I/O memory region
  virt | Virtual address.
  size | Size of the region in Bytes, granularity pages.
  flags | See l4io_iomem_flags_t

Return values

  0 | Success.
  -L4_ENOENT | No area could be found to map the IO memory region.
  -L4_EPERM | Operation not allowed.
  -L4_EINVAL | Invalid value.
  -L4_EADDRNOTAVAIL | The requested virtual address is not available.
  -L4_ENOMEM | The requested IO memory region could not be allocated.
  <0 | IPC errors.

Note
  This function uses L4Re functionality to reserve a part of the virtual address space of the caller.

References L4_CV, and L4_EXPORT.

## l4io_request_ioport()

long l4io_request_ioport | ( | unsigned | portnum,
|  | unsigned | len )

Request an IO port region.

Parameters

  portnum | Start of port range to request
  len | Length of range to request

Returns
  0 on success, <0 on error

Note
  X86 architecture only

References L4_CV, and L4_EXPORT.

## l4io_request_resource_iomem()

l4_addr_t l4io_request_resource_iomem | ( | l4io_device_handle_t | devhandle,
|  | l4io_resource_handle_t * | reshandle )

Request IO memory.

Parameters

  | devhandle | Device handle.
  [in,out] | reshandle | Resource handle from which IO memory should be requested. Upon successfull completion 'reshandle' points to the device's next resource.

Return values

  0 | An error occured. The value of 'reshandle' is undefined.
  >0 | The virtual address of the IO memory mapping.

References L4_CV, and L4_EXPORT.