source: trunk/hal/tsar_mips32/drivers/soclib_iob.h @ 307

Last change on this file since 307 was 75, checked in by max@…, 7 years ago

Create the drivers/ sub-directory in each hal, and move soclib
into it. Note that soclib is not valid for x86_64, but more
changes will come.

File size: 6.3 KB
RevLine 
[75]1/*
2 * soclib_iob.h - soclib IOB driver API definition.
3 *
4 * Alain Greiner    (2016)
5 *
6 * Copyright (c) UPMC Sorbonne Universites
7 *
8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
14 * ALMOS-MKH is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef _SOCLIB_IOB_H_
25#define _SOCLIB_IOB_H_
26
27#include <hal_types.h>
28#include <chdev.h>
29
30/******************************************************************************************
31 *    SOCLIB_IOB  Registers Mnemonics
32 *****************************************************************************************/
33
34enum IOB_registers
35{
36    IOB_IOMMU_PTPR       = 0,      // R/W : Page Table Pointer Register
37    IOB_IOMMU_ACTIVE     = 1,      // R/W : IOMMU activated if not 0
38    IOB_IOMMU_BVAR       = 2,      // R   : Bad Virtual Address (unmapped)
39    IOB_IOMMU_ERROR      = 3,      // R   : Error Type
40    IOB_IOMMU_SRCID      = 4,      // R   : Faulty Peripheral Index (SRCID)
41    IOB_INVAL_PTE        = 5,      // W   : Invalidate a PTE (virtual address)
42    IOB_WTI_ENABLE       = 6,      // R/W : Enable WTIs (both IOMMU and peripherals)
43    IOB_WTI_ADDR_LO      = 7,      // W/R : 32 LSB bits for IOMMU WTI
44    IOB_WTI_ADDR_HI      = 8,      // W/R : 32 MSB bits for IOMMU WTI
45};
46
47enum mmu_error_type_e
48{
49    MMU_NONE                      = 0x0000, // None
50    MMU_WRITE_ACCES_VIOLATION     = 0x0008, // Write access to a non writable page
51    MMU_WRITE_PT1_ILLEGAL_ACCESS  = 0x0040, // Write Bus Error accessing Table 1       
52    MMU_READ_PT1_UNMAPPED             = 0x1001, // Read  Page fault on Page Table 1     
53    MMU_READ_PT2_UNMAPPED             = 0x1002, // Read  Page fault on Page Table 2 
54    MMU_READ_PT1_ILLEGAL_ACCESS   = 0x1040, // Read  Bus Error in Table1 access     
55    MMU_READ_PT2_ILLEGAL_ACCESS   = 0x1080, // Read  Bus Error in Table2 access         
56    MMU_READ_DATA_ILLEGAL_ACCESS  = 0x1100, // Read  Bus Error in cache access
57};
58
59
60/******************************************************************************************
61 * This function initializes the SOCLIB IOB component:
62 ******************************************************************************************
63 * @ chdev   : local pointer on IOB chdev descriptor.
64 *****************************************************************************************/
65void soclib_iob_init( chdev_t * chdev );
66
67/******************************************************************************************
68 * This function set a new value in the IOB_IOMMU_ACTIVE register.
69 ******************************************************************************************
70 * @ iob_xp     : extended pointer on the remote XCU device descriptor.
71 * @ value      : value to be written in register.
72 *****************************************************************************************/
73void soclib_iob_set_active( xptr_t   iox_xp,
74                            uint32_t value );
75
76/******************************************************************************************
77 * This function set a new value in the IOB_IOMMU_PTPR register.
78 ******************************************************************************************
79 * @ iob_xp     : extended pointer on the remote XCU device descriptor.
80 * @ value      : value to be written in register IOMMU.
81 *****************************************************************************************/
82void soclib_iob_set_ptpr( xptr_t   iob_xp,
83                          uint32_t value );
84
85/******************************************************************************************
86 * This function invaldates a TLB entry identified by its vpn.
87 ******************************************************************************************
88 * @ iox_xp     : extended pointer on the remote XCU device descriptor.
89 * @ vpn        : virtual page number.
90 *****************************************************************************************/
91void soclib_iob_inval_page( xptr_t  iox_xp,
92                            vpn_t   vpn );
93
94/******************************************************************************************
95 * This function returns the content of IOB_IOMMU_BVAR register.
96 ******************************************************************************************
97 * @ iox_xp     : extended pointer on the remote XCU device descriptor.
98 * @ return registered bad virtual address (after error reported by IOMMU).
99 *****************************************************************************************/
100uint32_t soclib_iob_get_bvar( xptr_t  iox_xp );
101
102/******************************************************************************************
103 * This function returns the content of IOB_IOMMU_SRCID register.
104 ******************************************************************************************
105 * @ iox_xp     : extended pointer on the remote XCU device descriptor.
106 * @ return registered faulty peripheral index (after error reported by IOMMU).
107 *****************************************************************************************/
108uint32_t soclib_iob_get_srcid( xptr_t  iox_xp );
109
110/******************************************************************************************
111 * This function returns the content of IOB_IOMMU_ERROR register.
112 ******************************************************************************************
113 * @ iox_xp     : extended pointer on the remote XCU device descriptor.
114 * @ return registered error type (after error reported by IOMMU).
115 *****************************************************************************************/
116uint32_t soclib_iob_get_error( xptr_t  iox_xp );
117
118
119
120#endif
121
122// Local Variables:
123// tab-width: 4
124// c-basic-offset: 4
125// c-file-offsets:((innamespace . 0)(inline-open . 0))
126// indent-tabs-mode: nil
127// End:
128// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
129
Note: See TracBrowser for help on using the repository browser.