summaryrefslogtreecommitdiffstats
path: root/src/external/python.m4
blob: c91e8df17b0371538f02bfeb9cade1ce639074bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
dnl Check for python-config and substitute needed CFLAGS and LDFLAGS
dnl Usage:
dnl     AM_PYTHON_CONFIG(python_with_major_version)
dnl     argument python_with_major_version should be either python2 or python3
dnl This function sets the PYTHON_CFLAGS, PYTHON_LIBS and PYTHON_INCLUDES
dnl variables

AC_DEFUN([AM_PYTHON_CONFIG],
[
    AC_PATH_PROG([PYTHON_CONFIG], [python$PYTHON_VERSION-config])
    AS_IF([test x"$PYTHON_CONFIG" = x],
          AC_MSG_ERROR([
The program python$PYTHON_VERSION-config was not found in search path.
Please ensure that it is installed and its directory is included in the search
path. If you want to build sssd without $1 bindings then specify
--without-$1-bindings when running configure.]))

    PYTHON_CFLAGS="` $PYTHON_CONFIG --cflags`"
    PYTHON_LIBS="` $PYTHON_CONFIG --libs`"
    PYTHON_INCLUDES="` $PYTHON_CONFIG --includes`"
])

dnl Taken from GNOME sources
dnl a macro to check for ability to create python extensions
dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[
    AC_REQUIRE([AM_PATH_PYTHON])
    AC_MSG_CHECKING(for headers required to compile python extensions)

    dnl check if the headers exist:
    save_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
    AC_TRY_CPP([#include <Python.h>],dnl
               [AC_MSG_RESULT([found])
                $1],dnl
               [AC_MSG_RESULT([not found])
               $2])
    CPPFLAGS="$save_CPPFLAGS"
])


dnl Checks for a couple of functions we use that may not be defined
dnl in some older python (< 2.6) versions used e.g. on RHEL6
AC_DEFUN([AM_CHECK_PYTHON_COMPAT],
[
    AC_REQUIRE([AM_CHECK_PYTHON_HEADERS])
    save_CPPFLAGS="$CPPFLAGS"
    save_LIBS="$LIBS"
    CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
    LIBS="$LIBS $PYTHON_LIBS"

    AC_CHECK_FUNCS([PyErr_NewExceptionWithDoc])

    CPPFLAGS="$save_CPPFLAGS"
    LIBS="$save_LIBS"
])

dnl Clean variables after detection of python
AC_DEFUN([SSS_CLEAN_PYTHON_VARIABLES],
[
    unset pyexecdir pkgpyexecdir pythondir pgkpythondir
    unset PYTHON PYTHON_CFLAGS PYTHON_LIBS PYTHON_INCLUDES
    unset PYTHON_PREFIX PYTHON_EXEC_PREFIX PYTHON_VERSION PYTHON_CONFIG

    dnl removed cached variables, required for reusing of AM_PATH_PYTHON
    unset am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version
    unset am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
    unset ac_cv_path_PYTHON_CONFIG
])
n class="hl com"> * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <fsl_sec_mon.h> static u32 get_sec_mon_state(void) { struct ccsr_sec_mon_regs *sec_mon_regs = (void *) (CONFIG_SYS_SEC_MON_ADDR); return sec_mon_in32(&sec_mon_regs->hp_stat) & HPSR_SSM_ST_MASK; } static int set_sec_mon_state_non_sec(void) { u32 sts; int timeout = 10; struct ccsr_sec_mon_regs *sec_mon_regs = (void *) (CONFIG_SYS_SEC_MON_ADDR); sts = get_sec_mon_state(); switch (sts) { /* * If initial state is check or Non-Secure, then set the Software * Security Violation Bit and transition to Non-Secure State. */ case HPSR_SSM_ST_CHECK: printf("SEC_MON state transitioning to Non Secure.\n"); sec_mon_setbits32(&sec_mon_regs->hp_com, HPCOMR_SW_SV); /* polling loop till SEC_MON is in Non Secure state */ while (timeout) { sts = get_sec_mon_state(); if ((sts & HPSR_SSM_ST_MASK) == HPSR_SSM_ST_NON_SECURE) break; udelay(10); timeout--; } if (timeout == 0) { printf("SEC_MON state transition timeout.\n"); return -1; } break; /* * If initial state is Trusted, Secure or Soft-Fail, then first set * the Software Security Violation Bit and transition to Soft-Fail * State. */ case HPSR_SSM_ST_TRUST: case HPSR_SSM_ST_SECURE: case HPSR_SSM_ST_SOFT_FAIL: printf("SEC_MON state transitioning to Soft Fail.\n"); sec_mon_setbits32(&sec_mon_regs->hp_com, HPCOMR_SW_SV); /* polling loop till SEC_MON is in Soft-Fail state */ while (timeout) { sts = get_sec_mon_state(); if ((sts & HPSR_SSM_ST_MASK) == HPSR_SSM_ST_SOFT_FAIL) break; udelay(10); timeout--; } if (timeout == 0) { printf("SEC_MON state transition timeout.\n"); return -1; } timeout = 10; /* * If SSM Soft Fail to Non-Secure State Transition * disable is not set, then set SSM_ST bit and * transition to Non-Secure State. */ if ((sec_mon_in32(&sec_mon_regs->hp_com) & HPCOMR_SSM_SFNS_DIS) == 0) { printf("SEC_MON state transitioning to Non Secure.\n"); sec_mon_setbits32(&sec_mon_regs->hp_com, HPCOMR_SSM_ST); /* polling loop till SEC_MON is in Non Secure*/ while (timeout) { sts = get_sec_mon_state(); if ((sts & HPSR_SSM_ST_MASK) == HPSR_SSM_ST_NON_SECURE) break; udelay(10); timeout--; } if (timeout == 0) { printf("SEC_MON state transition timeout.\n"); return -1; } } break; default: printf("SEC_MON already in Non Secure state.\n"); return 0; } return 0; } static int set_sec_mon_state_soft_fail(void) { u32 sts; int timeout = 10;