]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/s390/dl-procinfo.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / s390 / dl-procinfo.h
CommitLineData
33516494 1/* s390 version of processor capability information handling macros.
f7a9f785 2 Copyright (C) 2006-2016 Free Software Foundation, Inc.
33516494
UD
3 This file is part of the GNU C Library.
4 Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2006.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
33516494
UD
19
20#ifndef _DL_PROCINFO_H
21#define _DL_PROCINFO_H 1
22#include <ldsodefs.h>
23
4e28fa80 24#define _DL_HWCAP_COUNT 12
33516494 25
a1b0488f 26#define _DL_PLATFORMS_COUNT 8
33516494
UD
27
28/* The kernel provides up to 32 capability bits with elf_hwcap. */
29#define _DL_FIRST_PLATFORM 32
30/* Mask to filter out platforms. */
31#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
32 << _DL_FIRST_PLATFORM)
33
382466e0 34/* Hardware capability bit numbers are derived directly from the
33516494 35 facility indications as stored by the "store facility list" (STFL)
d0f8457e
AK
36 instruction.
37 highgprs is an alien in that list. It describes a *kernel*
38 capability. */
33516494
UD
39
40enum
41{
42 HWCAP_S390_ESAN3 = 1 << 0,
43 HWCAP_S390_ZARCH = 1 << 1,
44 HWCAP_S390_STFLE = 1 << 2,
45 HWCAP_S390_MSA = 1 << 3,
46 HWCAP_S390_LDISP = 1 << 4,
47 HWCAP_S390_EIMM = 1 << 5,
48 HWCAP_S390_DFP = 1 << 6,
f957edde
AK
49 HWCAP_S390_HPAGE = 1 << 7,
50 HWCAP_S390_ETF3EH = 1 << 8,
51 HWCAP_S390_HIGH_GPRS = 1 << 9,
d0f8457e 52 HWCAP_S390_TE = 1 << 10,
4e28fa80 53 HWCAP_S390_VX = 1 << 11,
33516494
UD
54};
55
56#define HWCAP_IMPORTANT (HWCAP_S390_ZARCH | HWCAP_S390_LDISP \
57 | HWCAP_S390_EIMM | HWCAP_S390_DFP)
58
59/* We cannot provide a general printing function. */
1ae8bfe0 60#define _dl_procinfo(type, word) -1
33516494
UD
61
62static inline const char *
63__attribute__ ((unused))
64_dl_hwcap_string (int idx)
65{
66 return GLRO(dl_s390_cap_flags)[idx];
67};
68
69static inline const char *
70__attribute__ ((unused))
71_dl_platform_string (int idx)
72{
73 return GLRO(dl_s390_platforms)[idx - _DL_FIRST_PLATFORM];
74};
75
76static inline int
77__attribute__ ((unused, always_inline))
78_dl_string_hwcap (const char *str)
79{
80 int i;
81
82 for (i = 0; i < _DL_HWCAP_COUNT; i++)
83 {
84 if (strcmp (str, GLRO(dl_s390_cap_flags)[i]) == 0)
85 return i;
86 }
87 return -1;
88};
89
90static inline int
91__attribute__ ((unused, always_inline))
92_dl_string_platform (const char *str)
93{
94 int i;
95
96 if (str != NULL)
97 for (i = 0; i < _DL_PLATFORMS_COUNT; ++i)
98 {
99 if (strcmp (str, GLRO(dl_s390_platforms)[i]) == 0)
100 return _DL_FIRST_PLATFORM + i;
101 }
102 return -1;
103};
104
105#endif /* dl-procinfo.h */