source: rtems/cpukit/include/pci.h @ e97806a

5
Last change on this file since e97806a 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.7 KB
Line 
1/*
2 * PCI library. Defines in this file was taken from FreeBSD and auto-generated
3 * pci_ids.h reused from RTEMS.
4 *
5 * COPYRIGHT (c) 2009 Cobham Gaisler AB.
6 *
7 * The license and distribution terms for this file may be
8 * found in the file LICENSE in this distribution or at
9 * http://www.rtems.org/license/LICENSE.
10 */
11
12#ifndef __PCI_H__
13#define __PCI_H__
14
15#include <pci/pcireg.h>
16#include <pci/ids.h>
17
18#define PCI_INVALID_VENDORDEVICEID    0xffffffff
19
20#define PCID_CLASS(class, dev) ((class << 8) | dev)
21#define PCID_PCI2PCI_BRIDGE PCID_CLASS(PCIC_BRIDGE, PCIS_BRIDGE_PCI)
22
23#include <pci/access.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* The PCI Library have the following build time configuration options. It is
30 * up to the BSP header file (bsp.h) to set options properly.
31 *
32 * BSP_PCI_BIG_ENDIAN    - Access inline routines will be for a big-endian PCI
33 *                         bus, if not defined the routines will assume that
34 *                         PCI is as the standard defines: little-endian.
35 *
36 *                         Note that drivers may be run-time configurable,
37 *                         meaning that they may adopt to either big-endian or
38 *                         little-endian PCI bus, the host driver or BSP may
39 *                         detect endianness during run-time.
40 */
41
42/* Error return values */
43enum {
44        PCISTS_ERR         = -1, /* Undefined Error */
45        PCISTS_OK          = 0,
46        PCISTS_EINVAL      = 1, /* Bad input arguments */
47        PCISTS_MSTABRT     = 2, /* CFG space access error (can be ignored) */
48};
49
50/* PCI System type can be used to determine system for drivers. Normally
51 * the system is Host, but the peripheral configuration library also supports
52 * being PCI peripheral not allowed to access configuration space.
53 *
54 * The active configuration Library set this variable.
55 */
56enum pci_system_type {
57        PCI_SYSTEM_NONE = 0,
58        PCI_SYSTEM_HOST = 1,
59        PCI_SYSTEM_PERIPHERAL = 2,
60};
61extern enum pci_system_type pci_system_type;
62
63/* PCI Bus Endianness. The PCI specification is little endian, however on some
64 * embedded systems (AT697-LEON2 for example) the PCI bus is defined as big
65 * endian (non-standard) in order to avoid byte-twisting.
66 */
67enum {
68        PCI_LITTLE_ENDIAN = 0,
69        PCI_BIG_ENDIAN = 1,
70};
71extern int pci_endian;
72
73/* Return the number of PCI busses in the system */
74extern int pci_bus_count(void);
75
76/* Scan the PCI bus and print the PCI device/functions/bridges and their
77 * current resources and size to the system console.
78 */
79extern void pci_print(void);
80
81/* Print current configuration of a single PCI device by reading PCI
82 * configuration space
83 */
84extern void pci_print_dev(pci_dev_t dev);
85extern void pci_print_device(int bus, int slot, int function);
86
87/*** PCI Configuration Space direct access routines ***/
88
89/* Function iterates over all PCI buses/devices/functions and calls
90 * func(PCIDEV,arg) for each present device. The iteration is stopped if
91 * func() returns non-zero result the same result is returned. As long
92 * as func() returns zero the function will keep on iterating, when all
93 * devices has been processed the function return zero.
94 *
95 * The function iterates over all devices/functions on all buses by accessing
96 * configuration space directly (PCI RAM data structures not used). This
97 * function is valid to call after PCI buses have been enumrated.
98 */
99extern int pci_for_each(int (*func)(pci_dev_t, void*), void *arg);
100
101/* Get PCI Configuration space BUS|SLOT|FUNC for a device matching PCI
102 * Vendor, Device and instance number 'index'.
103 *
104 * Return Values
105 * -1  pci_find_dev did not find a device matching the criterion.
106 *  0  device was found, *pdev was updated with the device's BUS|SLOT|FUNC
107 */
108extern int pci_find(uint16_t ven, uint16_t dev, int index, pci_dev_t *pdev);
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* __PCI_H__ */
Note: See TracBrowser for help on using the repository browser.