Subversion Repositories HelenOS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2726 vana 1
#ifndef _SAL_PROC_H
2
#define _SAL_PROC_H
3
//
4
//
5
//Copyright (c) 1999  Intel Corporation
6
//
7
//Module Name:
8
//
9
//    SalProc.h
10
//
11
//Abstract:
12
//
13
//    Main SAL interface routins for IA-64 calls. 
14
//
15
//
16
//Revision History
17
//
18
//
19
 
20
//  return value that mimicks r8,r9,r10 & r11 registers 
21
typedef struct {
22
    UINT64     p0;
23
    UINT64     p1;
24
    UINT64     p2;
25
    UINT64     p3;
26
} rArg;
27
 
28
#define  SAL_PCI_CONFIG_READ                    0x01000010
29
#define  SAL_PCI_CONFIG_WRITE                   0x01000011
30
 
31
typedef VOID (*PFN)();
32
typedef rArg (*PFN_SAL_PROC)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
33
typedef rArg (*PFN_SAL_CALLBACK)(UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64,UINT64);
34
 
35
typedef struct _PLABEL {
36
   UINT64 ProcEntryPoint;
37
   UINT64 GP;
38
} PLABEL;
39
 
40
typedef struct tagIA32_BIOS_REGISTER_STATE {
41
 
42
    // general registers
43
    UINT32 eax;
44
    UINT32 ecx;
45
    UINT32 edx;
46
    UINT32 ebx;
47
 
48
    // stack registers
49
    UINT32 esp;
50
    UINT32 ebp;
51
    UINT32 esi;
52
    UINT32 edi;
53
 
54
    // eflags
55
    UINT32 eflags;
56
 
57
    // instruction pointer
58
    UINT32 eip;
59
 
60
    UINT16 cs;
61
    UINT16 ds;
62
    UINT16 es;
63
    UINT16 fs;
64
    UINT16 gs;
65
    UINT16 ss;
66
 
67
    // Reserved
68
    UINT32 Reserved1;
69
    UINT64 Reserved2;
70
} IA32_BIOS_REGISTER_STATE;
71
 
72
VOID EFIInitMsg(VOID);
73
 
74
EFI_STATUS
75
PlRegisterAndStartTimer(
76
    IN UINTN Period
77
    );
78
 
79
EFI_STATUS
80
PlDeRegisterAndCancelTimer(VOID);
81
 
82
VOID
83
SalProc (
84
    IN  UINT64    Arg1,
85
    IN  UINT64    Arg2,
86
    IN  UINT64    Arg3,
87
    IN  UINT64    Arg4,
88
    IN  UINT64    Arg5,
89
    IN  UINT64    Arg6,
90
    IN  UINT64    Arg7,
91
    IN  UINT64    Arg8,
92
    OUT rArg      *Results  OPTIONAL
93
    );
94
 
95
VOID
96
SalCallBack (
97
    IN  UINT64    Arg1,
98
    IN  UINT64    Arg2,
99
    IN  UINT64    Arg3,
100
    IN  UINT64    Arg4,
101
    IN  UINT64    Arg5,
102
    IN  UINT64    Arg6,
103
    IN  UINT64    Arg7,
104
    IN  UINT64    Arg8,
105
    OUT rArg      *Results  OPTIONAL
106
    );
107
 
108
VOID
109
RUNTIMEFUNCTION
110
RtSalCallBack (
111
    IN  UINT64    Arg1,
112
    IN  UINT64    Arg2,
113
    IN  UINT64    Arg3,
114
    IN  UINT64    Arg4,
115
    IN  UINT64    Arg5,
116
    IN  UINT64    Arg6,
117
    IN  UINT64    Arg7,
118
    IN  UINT64    Arg8,
119
    OUT rArg      *Results  OPTIONAL
120
    );
121
 
122
 
123
extern PLABEL   RtGlobalSalProcEntry;
124
extern PLABEL   RtGlobalSALCallBack;
125
 
126
#pragma pack(1)
127
//
128
// SAL System Table
129
//
130
typedef struct {
131
    UINT32 Signature;
132
    UINT32 Length;
133
    UINT16 Revision;
134
    UINT16 EntryCount;
135
    UINT8  CheckSum;
136
    UINT8  Reserved[7];
137
    UINT16 SALA_Ver;
138
    UINT16 SALB_Ver;
139
    UINT8  OemId[32];
140
    UINT8  ProductID[32];
141
    UINT8  Reserved2[8];
142
} SAL_SYSTEM_TABLE_HDR;
143
 
144
#define SAL_ST_ENTRY_POINT          0
145
#define SAL_ST_MEMORY_DESCRIPTOR    1
146
#define SAL_ST_PLATFORM_FEATURES    2
147
#define SAL_ST_TR_USAGE             3
148
#define SAL_ST_PTC                  4
149
#define SAL_ST_AP_WAKEUP            5
150
 
151
typedef struct {
152
    UINT8   Type;   //  Type == 0 
153
    UINT8   Reserved[7];
154
    UINT64  PalProcEntry;
155
    UINT64  SalProcEntry;
156
    UINT64  GlobalDataPointer;
157
    UINT64  Reserved2[2];
158
} SAL_ST_ENTRY_POINT_DESCRIPTOR;
159
 
160
typedef struct {
161
    UINT8   Type;   //  Type == 1
162
    UINT8   NeedVirtualRegistration;
163
    UINT8   MemoryAttributes;
164
    UINT8   PageAccessRights;
165
    UINT8   SupportedAttributes;
166
    UINT8   Reserved;
167
    UINT16  MemoryType;
168
    UINT64  PhysicalMemoryAddress;
169
    UINT32  Length;
170
    UINT32  Reserved1;
171
    UINT64  OemReserved;
172
} SAL_ST_MEMORY_DESCRIPTOR_ENTRY;
173
 
174
//
175
// MemoryType info
176
//
177
#define SAL_SAPIC_IPI_BLOCK 0x0002
178
#define SAL_IO_PORT_MAPPING 0x0003
179
 
180
typedef struct {
181
    UINT8   Type;   // Type == 2
182
    UINT8   PlatformFeatures;
183
    UINT8   Reserved[14];
184
} SAL_ST_MEMORY_DECRIPTOR;
185
 
186
typedef struct {
187
    UINT8   Type;   // Type == 3
188
    UINT8   TRType;
189
    UINT8   TRNumber;
190
    UINT8   Reserved[5];
191
    UINT64  VirtualAddress;
192
    UINT64  EncodedPageSize;
193
    UINT64  Reserved1;
194
} SAL_ST_TR_DECRIPTOR;
195
 
196
typedef struct {
197
    UINT64  NumberOfProcessors;
198
    UINT64  LocalIDRegister;
199
} SAL_COHERENCE_DOMAIN_INFO;
200
 
201
typedef struct {
202
    UINT8                       Type;   // Type == 4
203
    UINT8                       Reserved[3];
204
    UINT32                      NumberOfDomains;
205
    SAL_COHERENCE_DOMAIN_INFO  *DomainInformation;
206
} SAL_ST_CACHE_COHERENCE_DECRIPTOR;
207
 
208
typedef struct {
209
    UINT8   Type;   // Type == 5
210
    UINT8   WakeUpType;
211
    UINT8   Reserved[6];
212
    UINT64  ExternalInterruptVector;
213
} SAL_ST_AP_WAKEUP_DECRIPTOR;
214
 
215
typedef struct {
216
    SAL_SYSTEM_TABLE_HDR            Header;
217
    SAL_ST_ENTRY_POINT_DESCRIPTOR   Entry0;
218
} SAL_SYSTEM_TABLE_ASCENDING_ORDER;
219
 
220
#define     FIT_ENTRY_PTR       (0x100000000 - 32)  // 4GB - 24
221
#define     FIT_PALA_ENTRY      (0x100000000 - 48)  // 4GB - 32
222
#define     FIT_PALB_TYPE       01
223
 
224
typedef struct {
225
    UINT64  Address;
226
    UINT8   Size[3];
227
    UINT8   Reserved;
228
    UINT16  Revision;
229
    UINT8   Type:7;
230
    UINT8   CheckSumValid:1;
231
    UINT8   CheckSum;
232
} FIT_ENTRY;
233
 
234
#pragma pack()
235
 
236
typedef
237
 rArg
238
(*CALL_SAL_PROC)(
239
    IN  UINT64    Arg1,
240
    IN  UINT64    Arg2,
241
    IN  UINT64    Arg3,
242
    IN  UINT64    Arg4,
243
    IN  UINT64    Arg5,
244
    IN  UINT64    Arg6,
245
    IN  UINT64    Arg7,
246
    IN  UINT64    Arg8
247
    );
248
 
249
typedef
250
 rArg
251
(*CALL_PAL_PROC)(
252
    IN  UINT64    Arg1,
253
    IN  UINT64    Arg2,
254
    IN  UINT64    Arg3,
255
    IN  UINT64    Arg4
256
    );
257
 
258
extern CALL_SAL_PROC   GlobalSalProc;
259
extern CALL_PAL_PROC   GlobalPalProc;
260
extern PLABEL   SalProcPlabel;
261
extern PLABEL   PalProcPlabel;
262
 
263
#endif
264