source: soft/giet_vm/giet_drivers/iob_driver.c @ 378

Last change on this file since 378 was 340, checked in by cfuguet, 10 years ago

giet_vm/iob_driver:

  • The XICU_BASE and XICU_SIZE registers do not exist anymore in the VCI_IO_BRIDGE component. The routing of WTI commands by the IOB is done statically by using the special attribute on the IOX segments.
File size: 3.7 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : iob_driver.c
3// Date     : 23/05/2013
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// The iob_driver.c and iob_driver.h files are part ot the GIET-VM kernel.
8// This driver supports the TSAR vci_io_bridge, that is a bridge to access
9// The external peripherals, implementing an IO_MMU.
10// This component can be instanciated in more than one cluster.
11///////////////////////////////////////////////////////////////////////////////////
12// The SEG_IOB_BASE virtual addresses must be defined in hard_config.h file.
13// The physical base address is supposed to be (cluster_xy << 32) | SEG_IOB_BASE.
14///////////////////////////////////////////////////////////////////////////////////
15
16#include <giet_config.h>
17#include <iob_driver.h>
18#include <utils.h>
19
20#if !defined(SEG_IOB_BASE)
21# error: You must define SEG_IOB_BASE in the hard_config.h file
22#endif
23
24#if !defined(GIET_USE_IOMMU)
25# error: You must define GIET_USE_IOMMU in the giet_config.h file
26#endif
27
28#if !defined( USE_IOB )
29# error: You must define USE_IOB in the hard_config.h file
30#endif
31
32
33///////////////////////////////////////////////////////////////////////////////
34// This low level function returns the value contained in register "index"
35// in the IOB component contained in cluster "cluster_xy"
36///////////////////////////////////////////////////////////////////////////////
37unsigned int _iob_get_register( unsigned int cluster_xy,   // cluster index
38                                unsigned int index )       // register index
39{
40    unsigned long long paddr = (unsigned long long)SEG_IOB_BASE + 
41                               ((unsigned long long)cluster_xy << 32) +
42                               ((unsigned long long)index << 2);
43
44    return _physical_read( paddr );
45}
46///////////////////////////////////////////////////////////////////////////////
47// This low level function sets a new value in register "index"
48// in the IOB component contained in cluster "cluster_xy"
49///////////////////////////////////////////////////////////////////////////////
50void _iob_set_register( unsigned int cluster_xy,       // cluster index
51                        unsigned int index,            // register index
52                        unsigned int value )           // value to be written
53{
54    unsigned long long paddr = (unsigned long long)SEG_IOB_BASE + 
55                               ((unsigned long long)cluster_xy << 32) +
56                               ((unsigned long long)index << 2);
57
58    _physical_write( paddr, value );
59}
60
61
62
63///////////////////////////////////////////////////////////////////////////////
64// This function invalidates a TLB entry identified by a virtual address.
65///////////////////////////////////////////////////////////////////////////////
66void _iob_inval_tlb_entry( unsigned int cluster_xy,
67                           unsigned int vaddr )
68{
69    _iob_set_register( cluster_xy,
70                       IOB_INVAL_PTE,
71                       vaddr );
72}
73
74///////////////////////////////////////////////////////////////////////////////
75// This function sets a new value in IOB_IOMMU_PTPR register.
76///////////////////////////////////////////////////////////////////////////////
77void _iob_set_iommu_ptpr( unsigned int cluster_xy,
78                          unsigned int value )
79{
80    _iob_set_register( cluster_xy,
81                       IOB_IOMMU_PTPR,
82                       value );
83}
84
85// Local Variables:
86// tab-width: 4
87// c-basic-offset: 4
88// c-file-offsets:((innamespace . 0)(inline-open . 0))
89// indent-tabs-mode: nil
90// End:
91// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
92
Note: See TracBrowser for help on using the repository browser.