source: rtems/bsps/powerpc/include/libcpu/io.h @ abc2164

5
Last change on this file since abc2164 was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * io.h
3 *
4 *          This file contains inline implementation of function to
5 *          deal with IO.
6 *
7 * It is a stripped down version of linux ppc file...
8 *
9 * Copyright (C) 1999  Eric Valette (valette@crf.canon.fr)
10 *                     Canon Centre Recherche France.
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16#ifndef _LIBCPU_IO_H
17#define _LIBCPU_IO_H
18
19
20#define PREP_ISA_IO_BASE        0x80000000
21#define PREP_ISA_MEM_BASE       0xc0000000
22#define PREP_PCI_DRAM_OFFSET    0x80000000
23
24#define CHRP_ISA_IO_BASE        0xfe000000
25#define CHRP_ISA_MEM_BASE       0xfd000000
26#define CHRP_PCI_DRAM_OFFSET    0x00000000
27
28/* _IO_BASE, _ISA_MEM_BASE, PCI_DRAM_OFFSET are now defined by bsp.h */
29
30#ifndef ASM
31
32#include <bsp.h>                /* for _IO_BASE & friends */
33#include <stdint.h>
34
35/* NOTE: The use of these macros is DISCOURAGED.
36 *       you should consider e.g. using in_xxx / out_xxx
37 *       with a device specific base address that is
38 *       defined by the BSP. This makes drivers easier
39 *       to port.
40 */
41#define inb(port)               in_8((uint8_t *)((port)+_IO_BASE))
42#define outb(val, port)         out_8((uint8_t *)((port)+_IO_BASE), (val))
43#define inw(port)               in_le16((uint16_t *)((port)+_IO_BASE))
44#define outw(val, port)         out_le16((uint16_t *)((port)+_IO_BASE), (val))
45#define inl(port)               in_le32((uint32_t *)((port)+_IO_BASE))
46#define outl(val, port)         out_le32((uint32_t *)((port)+_IO_BASE), (val))
47
48/*
49 * Enforce In-order Execution of I/O:
50 * Acts as a barrier to ensure all previous I/O accesses have
51 * completed before any further ones are issued.
52 */
53static inline void eieio(void)
54{
55        __asm__ __volatile__ ("eieio");
56}
57
58
59/* Enforce in-order execution of data I/O.
60 * No distinction between read/write on PPC; use eieio for all three.
61 */
62#define iobarrier_rw() eieio()
63#define iobarrier_r()  eieio()
64#define iobarrier_w()  eieio()
65
66/*
67 * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
68 */
69static inline uint8_t in_8(const volatile uint8_t *addr)
70{
71        uint8_t ret;
72
73        __asm__ __volatile__("lbz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
74        return ret;
75}
76
77static inline void out_8(volatile uint8_t *addr, uint8_t val)
78{
79        __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
80}
81
82static inline uint16_t in_le16(const volatile uint16_t *addr)
83{
84        uint16_t ret;
85
86        __asm__ __volatile__("lhbrx %0,0,%1; eieio" : "=r" (ret) :
87                              "r" (addr), "m" (*addr));
88        return ret;
89}
90
91static inline uint16_t in_be16(const volatile uint16_t *addr)
92{
93        uint16_t ret;
94
95        __asm__ __volatile__("lhz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
96        return ret;
97}
98
99static inline void out_le16(volatile uint16_t *addr, uint16_t val)
100{
101        __asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) :
102                              "r" (val), "r" (addr));
103}
104
105static inline void out_be16(volatile uint16_t *addr, uint16_t val)
106{
107        __asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
108}
109
110static inline uint32_t in_le32(const volatile uint32_t *addr)
111{
112        uint32_t ret;
113
114        __asm__ __volatile__("lwbrx %0,0,%1; eieio" : "=r" (ret) :
115                             "r" (addr), "m" (*addr));
116        return ret;
117}
118
119static inline uint32_t in_be32(const volatile uint32_t *addr)
120{
121        uint32_t ret;
122
123        __asm__ __volatile__("lwz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" (*addr));
124        return ret;
125}
126
127static inline void out_le32(volatile uint32_t *addr, uint32_t val)
128{
129        __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
130                             "r" (val), "r" (addr));
131}
132
133static inline void out_be32(volatile uint32_t *addr, uint32_t val)
134{
135        __asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
136}
137
138#endif /* ASM */
139#endif /* _LIBCPU_IO_H */
Note: See TracBrowser for help on using the repository browser.