summaryrefslogtreecommitdiffstats
path: root/gnu-efi-3.0/inc/aarch64/efibind.h
blob: 7b78a5a44b4cc328ee1aa17532d88897a8786614 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
 * Attempt at a port for the ARMv8 architecture.
 *
 * (c) Bart Kuivenhoven <bemk@redhat.com> - Red Hat - 2013
 *
 */

#if 0
#warning "The port for this architecture has been done quickly and \
comes with no guarantee that the types will be of correct size or \
value. If you are able to help in resolving this situation, please do \
otherwise, your patience is kindly requested as we are working on \
resolving these issues."
#endif

#if defined(__GNUC__)
        typedef long                int64_t;
        typedef unsigned long       uint64_t;
        typedef unsigned int        uint32_t;
        typedef int                 int32_t;
        typedef unsigned short      uint16_t;
        typedef short               int16_t;
        typedef unsigned char       uint8_t;
        typedef signed char         int8_t;
#else
        #error "GNU-Efi not ported for this compiler on this architecure yet"
#endif

/* These defines are dependent on the widths written above, why they are in
 * architecture dependent header files, I don't know. Moving them out into
 * multi-architecture headerfiles might save on some code duplication, but what
 * ever. */

#ifndef __WCHAR_TYPE__
# define __WCHAR_TYPE__ int16_t
#endif

typedef uint64_t   UINT64;
typedef int64_t    INT64;

#ifndef _BASETSD_H_
        typedef uint32_t   UINT32;
        typedef int32_t    INT32;
#endif

typedef uint16_t   UINT16;
typedef int16_t    INT16;
typedef uint8_t    UINT8;
typedef int8_t     INT8;
typedef __WCHAR_TYPE__ WCHAR;

#undef VOID
#define VOID    void

typedef int64_t    INTN;
typedef uint64_t   UINTN;

/* Should indicate the calling convention, prefixed to the function
 * On x86 it is defined as __cdecl */
#ifndef EFIAPI
#define EFIAPI
#endif

/* This is an educated guess, compiler accepts it though, so figuring it's
 * correct */
#if defined __GNUC__
#define INTERFACE_DECL(x) struct x
#endif

/* Have to dig into what these things do ... */
#define RUNTIMESERVICE
#define RUNTIMEFUNCTION

/* Is this really the alignment size? it is on x86_64,
 * Is it true for aarch64 is the quesdtion though? */
#define MIN_ALIGNMENT_SIZE  4

/* Ehrm .... yeah ... almost certainly wrong, but have to dig into the specs to
 * be sure */
#define EFIERR(a) (-a)

/*
 * As far as I know, this is right ... */
#define uefi_call_wrapper(func, va_num, ...)	func(__VA_ARGS__)

#define BREAKPOINT()        while (TRUE)

//
// Define macros to create data structure signatures.
//
#define EFI_SIGNATURE_16(A,B)             ((A) | (B<<8))
#define EFI_SIGNATURE_32(A,B,C,D)         (EFI_SIGNATURE_16(A,B)     | (EFI_SIGNATURE_16(C,D)     << 16))
#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))