source: trunk/kernel/devices/:w @ 1

Last change on this file since 1 was 1, checked in by alain, 8 years ago

First import

File size: 5.4 KB
Line 
1/*
2 * dev_iox.h - IOX (bridge to external I/O) generic device API.
3 *
4 * Authors   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 PARTIOXLAR 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 _DEV_IOX_H_
25#define _DEV_IOX_H_
26
27#include <almos_config.h>
28#include <hal_types.h>
29#include <spinlock.h>
30
31/*****************************************************************************************
32 *     Generic IOX (bridge to external IO peripherals) definition.
33 *
34 * The IOX device is used to access external peripherals. It implements an IO-MMU service
35 * for DMA transactions launched by DMA capable external peripherals.
36 * This IOX peripheral is acting as a dynamically configurable bridge, used for others
37 * I/O operations. Therefore, ALMOS-MKH does not use the IOX device waiting queue,
38 * and calls directly the IOX driver blocking functions, using the device lock to
39 * get exclusive access to the IOX bridge internal state.
40 ****************************************************************************************/
41 
42
43/*****************************************************************************************
44 * This enum defines the various implementations of the IOX generic device.
45 * This array must be kept consistent with the define in arch_info.h file
46 ****************************************************************************************/
47
48enum iox_impl_e
49{
50    IMPL_IOX_IOB =   0,         /* vci_iob component used in TSAR                       */
51    IMPL_IOX_I86 =   1,         /* TBD                                                  */
52}
53iox_impl_t;
54
55/*****************************************************************************************
56 * This function initializes the IOX device descriptor with IOMMU disabled.
57 *****************************************************************************************
58 * @ dev_xp     : extended pointer on IOX device descriptor.
59 ****************************************************************************************/
60void dev_iox_init( xptr_t dev_xp );
61
62/*****************************************************************************************
63 * This function activates the IOMMU for the IOX device identified by its
64 * extended pointer.
65 *****************************************************************************************
66 * @ dev_xp   : extended pointer on IOX device descriptor.
67 ****************************************************************************************/
68void dev_iox_iommu_enable( xptr_t dev_xp );
69
70/*****************************************************************************************
71 * This function desactivates the IO-MMU for the IOX device identified by its
72 * extended pointer.
73 *****************************************************************************************
74 * @ dev_xp   : extended pointer on IOX device descriptor.
75 ****************************************************************************************/
76void dev_iox_iommu_disable( xptr_t dev_xp );
77
78/*****************************************************************************************
79 * This function set a new value in the IO-MMU PTPR register.
80 *****************************************************************************************
81 * @ dev_xp   : extended pointer on IOX device descriptor.
82 * @ wdata    : value to be written in PTPR register.
83 ****************************************************************************************/
84void dev_iox_set_ptpr( xptr_t    dev_xp,
85                       uint32_t  wdata );
86                       
87/*****************************************************************************************
88 * This function invalidates an IOMMU TLB entry identified by its vpn.
89 *****************************************************************************************
90 * @ dev_xp   : extended pointer on IOX device descriptor.
91 * @ vpn      : virtual page number in IO virtual space.
92 ****************************************************************************************/
93void dev_iox_inval_page( xptr_t  dev_xp,
94                         vpn_t   vpn );
95
96/*****************************************************************************************
97 * This function return informations relative to an error reported by the IOMMU.
98 *****************************************************************************************
99 * @ dev_xp   : extended pointer on IOX device descriptor.
100 * @ error    : [out] pointer on buffer for erro type.
101 * @ bvar     : [out] pointer on buffer for bad virtual address.
102 * @ srcid    : [out] pointer on buffer for faulty peripheral index.
103 ****************************************************************************************/
104void dev_iox_get_status( xptr_t     dev_xp,
105                         uint32_t * error,
106                         uint32_t * bvar,
107                         uint32_t * srcid );
108
109#endif  /* _DEV_IOX_H_ */
Note: See TracBrowser for help on using the repository browser.