Browse Source

[efi] Add processor binding headers for ARM and AArch64

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
11ccfb67fa

+ 150
- 0
src/include/ipxe/efi/AArch64/ProcessorBind.h View File

@@ -0,0 +1,150 @@
1
+/** @file
2
+  Processor or Compiler specific defines and types for AArch64.
3
+
4
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6
+  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
7
+
8
+  This program and the accompanying materials
9
+  are licensed and made available under the terms and conditions of the BSD License
10
+  which accompanies this distribution.  The full text of the license may be found at
11
+  http://opensource.org/licenses/bsd-license.php
12
+
13
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
+
16
+**/
17
+
18
+#ifndef __PROCESSOR_BIND_H__
19
+#define __PROCESSOR_BIND_H__
20
+
21
+FILE_LICENCE ( BSD3 );
22
+
23
+///
24
+/// Define the processor type so other code can make processor based choices
25
+///
26
+#define MDE_CPU_AARCH64
27
+
28
+//
29
+// Make sure we are using the correct packing rules per EFI specification
30
+//
31
+#ifndef __GNUC__
32
+#pragma pack()
33
+#endif
34
+
35
+#if _MSC_EXTENSIONS
36
+  //
37
+  // use Microsoft* C complier dependent integer width types
38
+  //
39
+  typedef unsigned __int64    UINT64;
40
+  typedef __int64             INT64;
41
+  typedef unsigned __int32    UINT32;
42
+  typedef __int32             INT32;
43
+  typedef unsigned short      UINT16;
44
+  typedef unsigned short      CHAR16;
45
+  typedef short               INT16;
46
+  typedef unsigned char       BOOLEAN;
47
+  typedef unsigned char       UINT8;
48
+  typedef char                CHAR8;
49
+  typedef signed char         INT8;
50
+#else
51
+  //
52
+  // Assume standard AARCH64 alignment.
53
+  //
54
+  typedef unsigned long long  UINT64;
55
+  typedef long long           INT64;
56
+  typedef unsigned int        UINT32;
57
+  typedef int                 INT32;
58
+  typedef unsigned short      UINT16;
59
+  typedef unsigned short      CHAR16;
60
+  typedef short               INT16;
61
+  typedef unsigned char       BOOLEAN;
62
+  typedef unsigned char       UINT8;
63
+  typedef char                CHAR8;
64
+  typedef signed char         INT8;
65
+#endif
66
+
67
+///
68
+/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
69
+/// 8 bytes on supported 64-bit processor instructions)
70
+///
71
+typedef UINT64  UINTN;
72
+
73
+///
74
+/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
75
+/// 8 bytes on supported 64-bit processor instructions)
76
+///
77
+typedef INT64   INTN;
78
+
79
+//
80
+// Processor specific defines
81
+//
82
+
83
+///
84
+/// A value of native width with the highest bit set.
85
+///
86
+#define MAX_BIT     0x8000000000000000ULL
87
+
88
+///
89
+/// A value of native width with the two highest bits set.
90
+///
91
+#define MAX_2_BITS  0xC000000000000000ULL
92
+
93
+///
94
+/// Maximum legal AARCH64  address
95
+///
96
+#define MAX_ADDRESS   0xFFFFFFFFFFFFFFFFULL
97
+
98
+///
99
+/// Maximum legal AArch64 INTN and UINTN values.
100
+///
101
+#define MAX_INTN   ((INTN)0x7FFFFFFFFFFFFFFFULL)
102
+#define MAX_UINTN  ((UINTN)0xFFFFFFFFFFFFFFFFULL)
103
+
104
+///
105
+/// The stack alignment required for AARCH64
106
+///
107
+#define CPU_STACK_ALIGNMENT  16
108
+
109
+//
110
+// Modifier to ensure that all protocol member functions and EFI intrinsics
111
+// use the correct C calling convention. All protocol member functions and
112
+// EFI intrinsics are required to modify their member functions with EFIAPI.
113
+//
114
+#define EFIAPI
115
+
116
+// When compiling with Clang, we still use GNU as for the assembler, so we still
117
+// need to define the GCC_ASM* macros.
118
+#if defined(__GNUC__) || defined(__clang__)
119
+  ///
120
+  /// For GNU assembly code, .global or .globl can declare global symbols.
121
+  /// Define this macro to unify the usage.
122
+  ///
123
+  #define ASM_GLOBAL .globl
124
+
125
+  #define GCC_ASM_EXPORT(func__)  \
126
+         .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
127
+         .type ASM_PFX(func__), %function
128
+
129
+  #define GCC_ASM_IMPORT(func__)  \
130
+         .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
131
+
132
+#endif
133
+
134
+/**
135
+  Return the pointer to the first instruction of a function given a function pointer.
136
+  On ARM CPU architectures, these two pointer values are the same,
137
+  so the implementation of this macro is very simple.
138
+
139
+  @param  FunctionPointer   A pointer to a function.
140
+
141
+  @return The pointer to the first instruction of a function given a function pointer.
142
+
143
+**/
144
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
145
+
146
+#ifndef __USER_LABEL_PREFIX__
147
+#define __USER_LABEL_PREFIX__
148
+#endif
149
+
150
+#endif

+ 171
- 0
src/include/ipxe/efi/Arm/ProcessorBind.h View File

@@ -0,0 +1,171 @@
1
+/** @file
2
+  Processor or Compiler specific defines and types for ARM.
3
+
4
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6
+  This program and the accompanying materials
7
+  are licensed and made available under the terms and conditions of the BSD License
8
+  which accompanies this distribution.  The full text of the license may be found at
9
+  http://opensource.org/licenses/bsd-license.php
10
+
11
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
+
14
+**/
15
+
16
+#ifndef __PROCESSOR_BIND_H__
17
+#define __PROCESSOR_BIND_H__
18
+
19
+FILE_LICENCE ( BSD3 );
20
+
21
+///
22
+/// Define the processor type so other code can make processor based choices
23
+///
24
+#define MDE_CPU_ARM
25
+
26
+//
27
+// Make sure we are using the correct packing rules per EFI specification
28
+//
29
+#ifndef __GNUC__
30
+#pragma pack()
31
+#endif
32
+
33
+#if _MSC_EXTENSIONS
34
+  //
35
+  // use Microsoft* C complier dependent integer width types
36
+  //
37
+  typedef unsigned __int64    UINT64;
38
+  typedef __int64             INT64;
39
+  typedef unsigned __int32    UINT32;
40
+  typedef __int32             INT32;
41
+  typedef unsigned short      UINT16;
42
+  typedef unsigned short      CHAR16;
43
+  typedef short               INT16;
44
+  typedef unsigned char       BOOLEAN;
45
+  typedef unsigned char       UINT8;
46
+  typedef char                CHAR8;
47
+  typedef signed char         INT8;
48
+#else
49
+  //
50
+  // Assume standard ARM alignment.
51
+  // Need to check portability of long long
52
+  //
53
+  typedef unsigned long long  UINT64;
54
+  typedef long long           INT64;
55
+  typedef unsigned int        UINT32;
56
+  typedef int                 INT32;
57
+  typedef unsigned short      UINT16;
58
+  typedef unsigned short      CHAR16;
59
+  typedef short               INT16;
60
+  typedef unsigned char       BOOLEAN;
61
+  typedef unsigned char       UINT8;
62
+  typedef char                CHAR8;
63
+  typedef signed char         INT8;
64
+#endif
65
+
66
+///
67
+/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
68
+/// 8 bytes on supported 64-bit processor instructions)
69
+///
70
+typedef UINT32  UINTN;
71
+
72
+///
73
+/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
74
+/// 8 bytes on supported 64-bit processor instructions)
75
+///
76
+typedef INT32   INTN;
77
+
78
+//
79
+// Processor specific defines
80
+//
81
+
82
+///
83
+/// A value of native width with the highest bit set.
84
+///
85
+#define MAX_BIT      0x80000000
86
+
87
+///
88
+/// A value of native width with the two highest bits set.
89
+///
90
+#define MAX_2_BITS   0xC0000000
91
+
92
+///
93
+/// Maximum legal ARM address
94
+///
95
+#define MAX_ADDRESS  0xFFFFFFFF
96
+
97
+///
98
+/// Maximum legal ARM INTN and UINTN values.
99
+///
100
+#define MAX_INTN   ((INTN)0x7FFFFFFF)
101
+#define MAX_UINTN  ((UINTN)0xFFFFFFFF)
102
+
103
+///
104
+/// The stack alignment required for ARM
105
+///
106
+#define CPU_STACK_ALIGNMENT  sizeof(UINT64)
107
+
108
+//
109
+// Modifier to ensure that all protocol member functions and EFI intrinsics
110
+// use the correct C calling convention. All protocol member functions and
111
+// EFI intrinsics are required to modify their member functions with EFIAPI.
112
+//
113
+#define EFIAPI
114
+
115
+// When compiling with Clang, we still use GNU as for the assembler, so we still
116
+// need to define the GCC_ASM* macros.
117
+#if defined(__GNUC__) || defined(__clang__)
118
+  ///
119
+  /// For GNU assembly code, .global or .globl can declare global symbols.
120
+  /// Define this macro to unify the usage.
121
+  ///
122
+  #define ASM_GLOBAL .globl
123
+
124
+  #if !defined(__APPLE__)
125
+    ///
126
+    /// ARM EABI defines that the linker should not manipulate call relocations
127
+    /// (do bl/blx conversion) unless the target symbol has function type.
128
+    /// CodeSourcery 2010.09 started requiring the .type to function properly
129
+    ///
130
+    #define INTERWORK_FUNC(func__)   .type ASM_PFX(func__), %function
131
+
132
+    #define GCC_ASM_EXPORT(func__)  \
133
+             .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
134
+             .type ASM_PFX(func__), %function
135
+
136
+    #define GCC_ASM_IMPORT(func__)  \
137
+             .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
138
+
139
+  #else
140
+    //
141
+    // .type not supported by Apple Xcode tools
142
+    //
143
+    #define INTERWORK_FUNC(func__)
144
+
145
+    #define GCC_ASM_EXPORT(func__)  \
146
+             .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    \
147
+
148
+    #define GCC_ASM_IMPORT(name)
149
+
150
+  #endif
151
+#endif
152
+
153
+/**
154
+  Return the pointer to the first instruction of a function given a function pointer.
155
+  On ARM CPU architectures, these two pointer values are the same,
156
+  so the implementation of this macro is very simple.
157
+
158
+  @param  FunctionPointer   A pointer to a function.
159
+
160
+  @return The pointer to the first instruction of a function given a function pointer.
161
+
162
+**/
163
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
164
+
165
+#ifndef __USER_LABEL_PREFIX__
166
+#define __USER_LABEL_PREFIX__
167
+#endif
168
+
169
+#endif
170
+
171
+

+ 8
- 0
src/include/ipxe/efi/ProcessorBind.h View File

@@ -18,4 +18,12 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
18 18
 #include <ipxe/efi/X64/ProcessorBind.h>
19 19
 #endif
20 20
 
21
+#if __arm__
22
+#include <ipxe/efi/Arm/ProcessorBind.h>
23
+#endif
24
+
25
+#if __aarch64__
26
+#include <ipxe/efi/AArch64/ProcessorBind.h>
27
+#endif
28
+
21 29
 #endif /* _IPXE_EFI_PROCESSOR_BIND_H */

Loading…
Cancel
Save