source: trunk/kernel/devices/dev_iob.h @ 316

Last change on this file since 316 was 279, checked in by alain, 7 years ago

1) Introduce independant command fields for the various devices in the thread descriptor.
2) Introduce a new dev_pic_enable_ipi() function in the generic PIC device
3) Fix two bugs identified by Maxime in the scheduler initialisation, and in the sched_select().
4) fix several bugs in the TSAR hal_kentry.S.
5) Introduce a third kgiet segment (besides kdata and kcode) in the TSAR bootloader.

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