Resource Allocation Module

Io serves several resource allocation requests and thereby manages I/O ports, I/O memory, and ISA DMA channels exclusively in the Common L4 Environment. More...

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...

Generic Resource Manipulation

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.

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.

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.


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.


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.

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.

Detailed Description

Io serves several resource allocation requests and thereby manages I/O ports, I/O memory, and ISA DMA channels exclusively in the Common L4 Environment.


Typedef Documentation

typedef struct io_ares io_ares_t

Announced I/O memory resources.

Announcements are kept in this list; i.e. current I/O memory mappings and corresponding local addresses.

typedef struct io_res io_res_t

Arbitrated resources (creating an USED SPACE list).

I/O's flat resource management scheme corresponds to the "leaves" in the Linux 2.4 resource tree. Only BUSY resources emerge in these lists.

Test:
krishna: OSKit AMM alternative?


Function Documentation

static int __search_region ( unsigned long  addr,
io_ares_t p,
unsigned long *  start,
unsigned long *  len 
) [static]

Generic search function.

Parameters:
addr Address to search for
root List to look at
Return values:
start Start address of region
len Length of region
Returns:
0 if a region could be found, <0 on error

Definition at line 210 of file res.c.

void callback_announce_mem_region ( unsigned long  addr,
unsigned long  len 
)

Announce I/O memory region.

On region announcement I/O has to request the given physical memory region from an appropriate pager.

Test:
krishna: Hopefully we'll get no doubled announcements - I don't check.
Todo:
sanity checks

Definition at line 788 of file res.c.

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.

Return values:
1 yes, we should allocated/handle this device
0 no, do not handle this device

Definition at line 883 of file res.c.

int io_res_init ( io_client_t c  ) 

Resource Module Initialization.

Parameters:
c l4io self client structure reference
Returns:
0 on success, negative error code otherwise
Initialize reserved resources: IRQ I/O ports, ...

Test:
krishna: This list is not complete ...

Definition at line 1050 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
channel ISA DMA channel
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise

Definition at line 722 of file res.c.

long l4_io_release_dma_component ( CORBA_Object  _dice_corba_obj,
unsigned long  channel,
CORBA_Server_Environment *  _dice_corba_env 
)

Release ISA DMA Channel.

Parameters:
_dice_corba_obj DICE corba object
channel ISA DMA channel
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise
Todo:
Implementation completion! For now it's deferred.

Definition at line 679 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
addr region start address
len region length
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise

Definition at line 592 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
addr region start address
len region length
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise

Definition at line 436 of file res.c.

long l4_io_request_dma_component ( CORBA_Object  _dice_corba_obj,
unsigned long  channel,
CORBA_Server_Environment *  _dice_corba_env 
)

Request ISA DMA Channel.

Parameters:
_dice_corba_obj DICE corba object
channel ISA DMA channel
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise
Todo:
Implementation completion! For now it's deferred.

Definition at line 643 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
addr region start address
len region length
region fpage descriptor for memory region
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise
The requested region is checked for availability and mapped into client's address space. Any policy regarding memory region has to be checked in this function.

Memory regions are kept in a list.

Definition at line 480 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
addr region start address
len region length
Return values:
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise
The requested region is checked for availability and mapped into client's address space. Port regions are kept in a list.

Definition at line 361 of file res.c.

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.

Parameters:
_dice_corba_obj DICE corba object
addr Address to search for
Return values:
start Start with memory region
len Length of memory region
_dice_corba_env corba environment
Returns:
0 on success, negative error code otherwise

Definition at line 570 of file res.c.


Variable Documentation

struct io_dma_res isa_dma[8] [static]

Initial value:

 {
  {0, NULL},
  {0, NULL},
  {0, NULL},
  {0, NULL},
  {0, NULL},
  {0, NULL},
  {0, NULL},
  {0, NULL},
}
ISA DMA channels.

Definition at line 113 of file res.c.


l4io, written by Christian Helmuth  © 2003 Technische Universitaet Dresden