Ignore:
Timestamp:
Sep 29, 2014, 12:02:13 PM (10 years ago)
Author:
alain
Message:

Introducing support for the PIC_MASK register in pic_driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/ioc_driver.h

    r295 r413  
    44// Author   : alain greiner
    55// Copyright (c) UPMC-LIP6
     6///////////////////////////////////////////////////////////////////////////////////
     7// The ioc_driver.c and ioc_driver.h files are part ot the GIET-VM kernel.
     8//
     9// This abstact driver define a generic API, supporting various physical
     10// block device controlers, including:
     11// - vci_block_device : single channel                     => bdv_driver
     12// - vci_ahci         : multi channels                     => hba_driver
     13// - sd_card          : single channel                     => sdc_driver
     14// - ramdisk (single channel meory mapped virtual disk)    => rdk_driver
     15//
     16// It can exist only one block-device type in the architecture, that must be
     17// defined by one of the following configuration variables in hard_config.h file:
     18// USE_IOC_BDV, USE_IOC_SDC, USE_IOC_HBA, USE_IOC_RDK.
     19//
     20// Any physical block device driver xxx must provide the following API:
     21// - _xxx_init()
     22// - _xxx_read()
     23// - _xxx_write()
     24// - _xxx_get_status()
     25// - _xxx_get_block_size()
     26// The "channel" parameter is no transmited to single channel devices.
     27//
     28// The _ioc_read() and _ioc_write() functions are always blocking for
     29// the calling user program.
     30//
     31// These functions compute the physical address of the memory buffer before
     32// calling the proper physical device. We know that the user buffer is mapped
     33// to a contiguous physical buffer because, for each vseg, the page tables
     34// are statically constructed to use contiguous physical memory.
     35//
     36// These functions can be called in 3 modes:
     37//
     38// - In BOOT mode, these functions use the buffer virtual address
     39//   as a physical address if the MMU is not activated.
     40//   They make a V2P translation if the MMU is activated.
     41//   This mode is used to load the map.bin file (before memory activation),
     42//   or to load the various .elf files (after MMU activation).
     43//
     44// - In KERNEL mode, these functions make a V2P translation to
     45//   compute the buffer physical address.
     46//   There is no checking of user access right to the memory buffer. 
     47//   This mode must be used for an "open" system call.
     48//
     49// - In USER mode, these functions make a V2P translation to
     50//   compute the buffer physical address.
     51//   The user access right to the memory buffer are checked. 
     52//   This mode must be used for a "read" or "write" system call.
     53//
     54// Finally, the memory buffer must fulfill the following conditions:
     55// - The buffer must be word aligned,
     56// - The buffer must be mapped in user space for an user access,
     57// - The buffer must be writable in case of (to_mem) access,
     58// - The total number of physical pages occupied by the user buffer cannot
     59//   be larger than 512 pages if the IOMMU is activated,
     60// - All physical pages occupied by the user buffer must be contiguous
     61//   if the IOMMU is not activated.
     62// Exit if these conditions are not verified.
     63//
     64// The SEG_IOC_BASE virtual base address must be defined in hard_config.h,
     65// as it is used by the BDV, HBA and SPI drivers.
     66//
     67// If the RAMDISK is used, an extra memory segment with virtual base address
     68// SEG_RDK_BASE, used by RDK driver, must be defined in hard_config.h.
     69///////////////////////////////////////////////////////////////////////////////////
     70// Implementation note:
     71//
     72// 1) In order to share the code, the two _ioc_read() and _ioc_write() functions
     73// call the same _ioc_access() function.
     74//
     75// 2) The IOMMU is not supported yet, but the method is the following:
     76// A fixed size 2 Mbytes vseg is allocated to the IOC peripheral, in the I/O
     77// virtual space, and the user buffer is dynamically remapped to one single
     78// big page in the IOMMU page table.
     79// The user buffer is unmapped by the _ioc_completed() function when
     80// the transfer is completed.
    681///////////////////////////////////////////////////////////////////////////////////
    782
     
    31106///////////////////////////////////////////////////////////////////////////////////
    32107
     108///////////////////////////////////////////////////////////////////////////////
     109// This function cheks block size, and desactivates the IOC interrupts.
     110// Return 0 for success, non zero if error.
     111///////////////////////////////////////////////////////////////////////////////
    33112extern unsigned int _ioc_init( unsigned int channel );
    34113
     114///////////////////////////////////////////////////////////////////////////////
     115// Transfer data from a memory buffer to the block device.
     116// - mode     : BOOT_PA / BOOT_VA / KERNEL / USER
     117// - lba      : first block index on the block device
     118// - buffer   : base address of the memory buffer (must be word aligned)
     119// - count    : number of blocks to be transfered.
     120// Returns 0 if success, > 0 if error.
     121///////////////////////////////////////////////////////////////////////////////
    35122extern unsigned int _ioc_write( unsigned int channel,
    36123                                unsigned int mode,
     
    39126                                unsigned int count );
    40127
     128///////////////////////////////////////////////////////////////////////////////
     129// Transfer data from the block device to a memory buffer.
     130// - mode     : BOOT_PA / BOOT_VA / KERNEL / USER
     131// - lba      : first block index on the block device
     132// - buffer   : base address of the memory buffer (must be word aligned)
     133// - count    : number of blocks to be transfered.
     134// Returns 0 if success, > 0 if error.
     135///////////////////////////////////////////////////////////////////////////////
    41136extern unsigned int _ioc_read(  unsigned int channel,
    42137                                unsigned int mode,
     
    45140                                unsigned int count );
    46141
     142///////////////////////////////////////////////////////////////////////////////
     143// This function returns in the status variable, the transfert status, and
     144// acknowledge the IRQ if the IOC controler is not busy.
     145// Returns 0 if success, > 0 if error
     146///////////////////////////////////////////////////////////////////////////////
    47147extern unsigned int _ioc_get_status( unsigned int channel );
    48148
     149///////////////////////////////////////////////////////////////////////////////
     150// This function returns the block_size for the block device.
     151///////////////////////////////////////////////////////////////////////////////
    49152extern unsigned int _ioc_get_block_size();
    50 
    51 ///////////////////////////////////////////////////////////////////////////////////
    52153
    53154
Note: See TracChangeset for help on using the changeset viewer.