/tmp/l4check/full_tree/trunk/l4/pkg/l4io/server/lib-pci/src/glue.c File Reference

L4Env l4io PCIlib Linux PCI Extracts Glue Code. More...

#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/mm.h>
#include <asm/io.h>
#include <l4/util/macros.h>
#include <l4/util/bitops.h>
#include "pcilib.h"
#include "io.h"
#include "res.h"
#include <asm/processor.h>

Go to the source code of this file.

Resource Management Glue for PCIlib

Linux' PCI subsystem _expects_ the new, hierarchical resource management system.

So it has to be mapped to io's flat allocation scheme:

  1. callback requests/releases only for IORESOURCE_BUSY regions
  2. announce top-level I/O memory regions (I/O has to initiate mappings from sigma0 or whomsoever)

Shame: Almost all of this is from Linux 2.4.x.

Test:
krishna: central root resources are essential - io{port,mem}_resource
Test:
krishna: no resources can be released (this only means no HOTPLUGGING is supported)


struct resource ioport_resource
 fake port resource (PCIlib glue)
struct resource iomem_resource
 fake memory resource (PCIlib glue)
unsigned long pci_mem_start = 0x80000000
 map MMIO regions above 2GB
static char * do_resource_list (struct resource *entry, const char *fmt, int offset, char *buf, char *end)
static struct resource * __request_resource (struct resource *root, struct resource *new)
 Generic resource requests.
struct resource * __request_region (struct resource *parent, unsigned long start, unsigned long n, const char *name)
 Generic region requests.
void __release_region (struct resource *parent, unsigned long start, unsigned long n)
static int __find_resource (struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, unsigned long align, void(*alignf)(void *, struct resource *, unsigned long, unsigned long), void *alignf_data)
 Generic Find empty slot in the resource tree given range and alignment.
int request_resource (struct resource *root, struct resource *new)
 Linux resource requests.
int allocate_resource (struct resource *root, struct resource *new, unsigned long size, unsigned long min, unsigned long max, unsigned long align, void(*alignf)(void *, struct resource *, unsigned long, unsigned long), void *alignf_data)
 Linux resource allocation.

Miscellaneous Glue for PCIlib

  • dev_probe_lock
    • dev_probe_unlock
    • simple_strtol (mapped to strtol)
    • schedule_timeout
    • .

..

struct cpuinfo_x86 boot_cpu_data
void dev_probe_lock (void)
 dev_probe_lock
void dev_probe_unlock (void)
 dev_probe_unlock
long simple_strtol (const char *cp, char **endp, unsigned int base)
 simple_strtol
signed long FASTCALL (schedule_timeout(signed long timeout))
 schedule_timeout
void __const_udelay (unsigned long usecs)
int remap_page_range (unsigned long from, unsigned long to, unsigned long size, pgprot_t prot)
void * pci_alloc_consistent (struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
void pci_free_consistent (struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
void FASTCALL (add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait))
void FASTCALL (remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait))
void FASTCALL (__wake_up(wait_queue_head_t *q, unsigned int mode, int nr))

Defines

#define DO_DEBUG   0
#define FASTCALL(x)   __attribute__((regparm(3))) x

Functions

void * malloc (size_t size)
void free (void *ptr)
unsigned int strtol (const char *nptr, char **endptr, int base)
Interrupt Line Request Glue for PCIlib
Mapping of PCIlib interrupt allocation.

int request_irq (unsigned int irq, void(*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *name, void *id)
 Request interrupt.
void free_irq (unsigned int irq, void *id)
 Free Interrupt.
Memory Management Glue for PCIlib
void * kmalloc (size_t size, int gfp)
 Well known kmalloc.
void kfree (const void *obj)
 Well known kfree.
unsigned long FASTCALL (__get_free_pages(unsigned int gfp, unsigned int order))
 Well known __get_free_pages.
void FASTCALL (free_pages(unsigned long addr, unsigned int order))
 Well known free_pages.
PCIlib interface
Todo:
/proc fs has to be optional


int PCI_init (int list)
 PCIlib initialization.
unsigned short PCI_linux_to_io (void *linux_pdev, void *l4io_pdev)
 Info Type Conversion.


Detailed Description

L4Env l4io PCIlib Linux PCI Extracts Glue Code.

Date:
05/28/2003
Author:
Christian Helmuth <ch12@os.inf.tu-dresden.de>

Definition in file glue.c.


Function Documentation

long simple_strtol ( const char *  cp,
char **  endp,
unsigned int  base 
)

simple_strtol

Test:
krishna: base is `unsigned int' NOT `int', but it's always `0' in the code (as far as I know)

Definition at line 406 of file glue.c.


Variable Documentation

struct resource iomem_resource

Initial value:

 {
  "PCI mem",
  0x00000000, 0xffffffff,
  IORESOURCE_MEM
}
fake memory resource (PCIlib glue)

Definition at line 85 of file glue.c.

struct resource ioport_resource

Initial value:

 {
  "PCI IO",
  0x0000, IO_SPACE_LIMIT,
  IORESOURCE_IO
}
fake port resource (PCIlib glue)

Definition at line 79 of file glue.c.


l4io, written by Christian Helmuth  © 2003 Technische Universitaet Dresden