/tmp/l4check/full_tree/trunk/l4/pkg/l4io/server/src/res.c File Reference

L4Env l4io I/O Server Resource Management Module. More...

#include <l4/sys/types.h>
#include <l4/env/errno.h>
#include <l4/sys/syscalls.h>
#include <l4/sys/ipc.h>
#include <l4/rmgr/librmgr.h>
#include <l4/l4rm/l4rm.h>
#include <l4/generic_io/generic_io-server.h>
#include <l4/sigma0/sigma0.h>
#include <stdio.h>
#include <stdlib.h>
#include "io.h"
#include "res.h"
#include "__config.h"
#include "__macros.h"

Go to the source code of this file.

Classes

struct  io_res
 Arbitrated resources (creating an USED SPACE list). More...
struct  io_ares
 Announced I/O memory resources. More...
struct  io_dma_res
 DMA resources. More...
struct  device_inclusion_list

Region Specific Interface Functions (internal callbacks)

Functions for system resource request, release, and announcement.

Test:
krishna: We assume single-threading here and above!
Todo:
Rethink release() and implement if appropriate.


static struct
device_inclusion_list * 
device_handle_inclusion_list
static struct
device_inclusion_list * 
device_handle_exclusion_list
int callback_request_region (unsigned long addr, unsigned long len)
 Request I/O port region.
int callback_request_mem_region (unsigned long addr, unsigned long len)
 Request I/O memory region.
void callback_announce_mem_region (unsigned long addr, unsigned long len)
 Announce I/O memory region.
int callback_handle_pci_device (unsigned short vendor, unsigned short device)
 Check if we should handle this specific PCI device

This is checked against the parameters the user provided on startup.

static int parse_device_pair (const char *s, unsigned short *vendor, unsigned short *device)
 parse a 'vendor:device' pair into nums
int add_device_inclusion (const char *s)
 add a new inclusion-entry
int add_device_exclusion (const char *s)
 add a new inclusion-entry
int bios_map_area (unsigned long *ret_vaddr)
 Map the BIOS32 service area.
void * bios_phys_to_virt (unsigned long paddr)
 BIOS32 service area-specific address translation.

Defines

#define IO_REQ_PAGESIZE   L4_SUPERPAGESIZE
#define IO_REQ_LOG2_PAGESIZE   L4_LOG2_SUPERPAGESIZE
#define IO_REQ_PAGEMASK   L4_SUPERPAGEMASK
#define io_req_trunc_page(a)   l4_trunc_superpage(a)
#define IO_PAGESIZE   L4_SUPERPAGESIZE
#define IO_LOG2_PAGESIZE   L4_LOG2_SUPERPAGESIZE
#define IO_PAGEMASK   L4_SUPERPAGEMASK
#define io_trunc_page(a)   l4_trunc_superpage(a)

Typedefs

typedef struct io_res io_res_t
 Arbitrated resources (creating an USED SPACE list).
typedef struct io_ares io_ares_t
 Announced I/O memory resources.

Functions

int io_res_init (io_client_t *c)
 Resource Module Initialization.
static void list_regions (void)
static void list_mem_regions (void)
static void list_amem_regions (void)
static void list_dma (void)
void list_res (void)
Generic Resource Manipulation
static io_client_tfind_client (l4_threadid_t tid)
 Find client structure.
static int __request_region (unsigned long start, unsigned long len, unsigned long max, io_res_t **root, io_client_t *c)
 Generic allocate region.
static int __search_region (unsigned long addr, io_ares_t *p, unsigned long *start, unsigned long *len)
 Generic search function.
static int __release_region (unsigned long start, unsigned long len, io_res_t **root, io_client_t *c)
 Generic release region.
static int __release_region_client (io_res_t **root, io_client_t *c)
 Generic release region for all regions of a specific client.
static void process_port_region (unsigned start, unsigned length, l4_snd_fpage_t **regions, l4_size_t *num)
 Split I/O port region into fpages.
Request/Release Interface Functions (IPC interface)
Functions for system resource request and release.

long l4_io_request_region_component (CORBA_Object _dice_corba_obj, l4_uint16_t addr, l4_uint16_t len, l4_size_t *num, l4_snd_fpage_t regions[], CORBA_Server_Environment *_dice_corba_env)
 Request I/O port region.
long l4_io_release_region_component (CORBA_Object _dice_corba_obj, l4_uint16_t addr, l4_uint16_t len, CORBA_Server_Environment *_dice_corba_env)
 Release I/O port region.
long l4_io_request_mem_region_component (CORBA_Object _dice_corba_obj, unsigned long addr, unsigned long len, unsigned long flags, l4_snd_fpage_t *region, CORBA_Server_Environment *_dice_corba_env)
 Request I/O memory region.
long l4_io_search_mem_region_component (CORBA_Object _dice_corba_obj, unsigned long addr, unsigned long *start, l4_size_t *len, CORBA_Server_Environment *_dice_corba_env)
 Search for I/O memory region.
long l4_io_release_mem_region_component (CORBA_Object _dice_corba_obj, unsigned long addr, unsigned long len, CORBA_Server_Environment *_dice_corba_env)
 Release I/O memory region.
long l4_io_request_dma_component (CORBA_Object _dice_corba_obj, unsigned long channel, CORBA_Server_Environment *_dice_corba_env)
 Request ISA DMA Channel.
long l4_io_release_dma_component (CORBA_Object _dice_corba_obj, unsigned long channel, CORBA_Server_Environment *_dice_corba_env)
 Release ISA DMA Channel.
long l4_io_release_client_component (CORBA_Object _dice_corba_obj, const l4_threadid_t *client, CORBA_Server_Environment *_dice_corba_env)
 Release all regions of a client.

Variables

static io_res_tio_port_res = NULL
 IO ports.
static io_res_tio_mem_res = NULL
 IO memory.
static io_ares_tio_mem_ares = NULL
 announced IO memory
static struct io_dma_res isa_dma [8]
 ISA DMA channels.
static io_client_tio_self
 l4io self client structure reference
static const l4_addr_t bios_paddr = 0xe0000
 BIOS32 service area 0xe0000-0xfffff.
static l4_addr_t bios_vaddr = 0
static const l4_size_t bios_size = 0x20000


Detailed Description

L4Env l4io I/O Server Resource Management Module.

Date:
2007-03-23
Author:
Christian Helmuth <ch12@os.inf.tu-dresden.de>

Definition in file res.c.


Function Documentation

int add_device_exclusion ( const char *  s  ) 

add a new inclusion-entry

Return values:
0 ok
-L4_EINVAL invalid format in parameter
-L4_ENOMEM out of mem

Definition at line 948 of file res.c.

int add_device_inclusion ( const char *  s  ) 

add a new inclusion-entry

Return values:
0 ok, l4env-error-code else

Definition at line 922 of file res.c.

int bios_map_area ( unsigned long *  ret_vaddr  ) 

Map the BIOS32 service area.

Parameters:
vaddr virtual address on successfull mapping (undefined on errors!)
Returns:
0 on success, negative error code otherwise
As L4RM does no implicit pf propagation anymore we need to explicitly map the BIOS32 service area for lib-pci.

Definition at line 979 of file res.c.

void* bios_phys_to_virt ( unsigned long  paddr  ) 

BIOS32 service area-specific address translation.

Parameters:
paddr physical address
Returns:
corresponding virtual address, or NULL on error

Definition at line 1026 of file res.c.

static io_client_t* find_client ( l4_threadid_t  tid  )  [static]

Find client structure.

Definition at line 137 of file res.c.

static int parse_device_pair ( const char *  s,
unsigned short *  vendor,
unsigned short *  device 
) [static]

parse a 'vendor:device' pair into nums

Return values:
0 - ok, invalid format else

Definition at line 904 of file res.c.

static void process_port_region ( unsigned  start,
unsigned  length,
l4_snd_fpage_t **  regions,
l4_size_t *  num 
) [static]

Split I/O port region into fpages.

Parameters:
regions pointer to fpage array
We split up arbitrary I/O port regions into chunks that can be processed by Fiasco (-> size-aligned and the size is a power of 2) and store these into the regions array.

Definition at line 304 of file res.c.


l4io, written by Christian Helmuth  © 2003 Technische Universitaet Dresden