1 /*++
2 
3 Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   TianoSpecApi.h
15 
16 Abstract:
17 
18   Tiano intrinsic definitions in Tiano spec.
19 
20 
21 --*/
22 
23 #ifndef _TIANO_SPEC_API_H_
24 #define _TIANO_SPEC_API_H_
25 
26 
27 #if ((TIANO_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
28 //
29 // Prior to UEFI 2.0 Tiano extended these enums. This was replaced by
30 // CreateEventEx() Event Groups in UEFI 2.0
31 //
32 #define EFI_EVENT_NOTIFY_SIGNAL_ALL     0x00000400
33 
34 #define EFI_EVENT_SIGNAL_READY_TO_BOOT  0x00000203
35 #define EFI_EVENT_SIGNAL_LEGACY_BOOT    0x00000204
36 #endif
37 
38 typedef
39 EFI_BOOTSERVICE
40 EFI_STATUS
41 (EFIAPI *EFI_ADD_MEMORY_SPACE) (
42   IN EFI_GCD_MEMORY_TYPE   GcdMemoryType,
43   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
44   IN UINT64                Length,
45   IN UINT64                Capabilities
46   )
47 /*++
48 
49 Routine Description:
50 
51   Adds reserved memory, system memory, or memory-mapped I/O resources to the
52 global coherency domain of the processor.
53 
54 Arguments:
55 
56   GcdMemoryType     - Memory type of the memory space.
57 
58   BaseAddress       - Base address of the memory space.
59 
60   Length            - Length of the memory space.
61 
62   Capabilities      - alterable attributes of the memory space.
63 
64 Returns:
65 
66   EFI_SUCCESS       - Merged this memory space into GCD map.
67 
68 --*/
69 ;
70 
71 typedef
72 EFI_BOOTSERVICE
73 EFI_STATUS
74 (EFIAPI *EFI_ALLOCATE_MEMORY_SPACE) (
75   IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
76   IN     EFI_GCD_MEMORY_TYPE                 GcdMemoryType,
77   IN     UINTN                               Alignment,
78   IN     UINT64                              Length,
79   IN OUT EFI_PHYSICAL_ADDRESS                * BaseAddress,
80   IN     EFI_HANDLE                          ImageHandle,
81   IN     EFI_HANDLE                          DeviceHandle OPTIONAL
82   )
83 /*++
84 
85 Routine Description:
86 
87   Allocates nonexistent memory, reserved memory, system memory, or memorymapped
88 I/O resources from the global coherency domain of the processor.
89 
90 Arguments:
91 
92   GcdAllocateType   - The type of allocate operation
93 
94   GcdMemoryType     - The desired memory type
95 
96   Alignment         - Align with 2^Alignment
97 
98   Length            - Length to allocate
99 
100   BaseAddress       - Base address to allocate
101 
102   Imagehandle       - The image handle consume the allocated space.
103 
104   DeviceHandle      - The device handle consume the allocated space.
105 
106 Returns:
107 
108   EFI_INVALID_PARAMETER       - Invalid parameter.
109 
110   EFI_NOT_FOUND               - No descriptor contains the desired space.
111 
112   EFI_SUCCESS                 - Memory space successfully allocated.
113 
114 --*/
115 ;
116 
117 typedef
118 EFI_BOOTSERVICE
119 EFI_STATUS
120 (EFIAPI *EFI_FREE_MEMORY_SPACE) (
121   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
122   IN UINT64                Length
123   )
124 /*++
125 
126 Routine Description:Routine Description:
127 
128   Frees nonexistent memory, reserved memory, system memory, or memory-mapped
129 I/O resources from the global coherency domain of the processor.
130 
131 Arguments:
132 
133   BaseAddress       - Base address of the segment.
134 
135   Length            - Length of the segment.
136 
137 Returns:
138 
139   EFI_SUCCESS       - Space successfully freed.
140 
141 --*/
142 ;
143 
144 typedef
145 EFI_BOOTSERVICE
146 EFI_STATUS
147 (EFIAPI *EFI_REMOVE_MEMORY_SPACE) (
148   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
149   IN UINT64                Length
150   )
151 /*++
152 
153 Routine Description:Routine Description:
154 
155   Removes reserved memory, system memory, or memory-mapped I/O resources from
156 the global coherency domain of the processor.
157 
158 Arguments:
159 
160   BaseAddress       - Base address of the memory space.
161 
162   Length            - Length of the memory space.
163 
164 Returns:
165 
166   EFI_SUCCESS       - Successfully remove a segment of memory space.
167 
168 --*/
169 ;
170 
171 typedef
172 EFI_BOOTSERVICE
173 EFI_STATUS
174 (EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR) (
175   IN  EFI_PHYSICAL_ADDRESS             BaseAddress,
176   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  * Descriptor
177   )
178 /*++
179 
180 Routine Description:
181 
182   Retrieves the descriptor for a memory region containing a specified address.
183 
184 Arguments:
185 
186   BaseAddress       - Specified start address
187 
188   Descriptor        - Specified length
189 
190 Returns:
191 
192   EFI_INVALID_PARAMETER       - Invalid parameter
193 
194   EFI_SUCCESS                 - Successfully get memory space descriptor.
195 
196 --*/
197 ;
198 
199 typedef
200 EFI_BOOTSERVICE
201 EFI_STATUS
202 (EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES) (
203   IN EFI_PHYSICAL_ADDRESS         BaseAddress,
204   IN UINT64                       Length,
205   IN UINT64                       Attributes
206   )
207 /*++
208 
209 Routine Description:
210 
211   Modifies the attributes for a memory region in the global coherency domain of the
212 processor.
213 
214 Arguments:
215 
216   BaseAddress       - Specified start address
217 
218   Length            - Specified length
219 
220   Attributes        - Specified attributes
221 
222 Returns:
223 
224   EFI_SUCCESS       - Successfully set attribute of a segment of memory space.
225 
226 --*/
227 ;
228 
229 typedef
230 EFI_BOOTSERVICE
231 EFI_STATUS
232 (EFIAPI *EFI_GET_MEMORY_SPACE_MAP) (
233   OUT UINTN                            *NumberOfDescriptors,
234   OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap
235   )
236 /*++
237 
238 Routine Description:
239 
240   Returns a map of the memory resources in the global coherency domain of the
241 processor.
242 
243 Arguments:
244 
245   NumberOfDescriptors       - Number of descriptors.
246 
247   MemorySpaceMap            - Descriptor array
248 
249 Returns:
250 
251   EFI_INVALID_PARAMETER     - Invalid parameter
252 
253   EFI_OUT_OF_RESOURCES      - No enough buffer to allocate
254 
255   EFI_SUCCESS               - Successfully get memory space map.
256 
257 --*/
258 ;
259 
260 typedef
261 EFI_BOOTSERVICE
262 EFI_STATUS
263 (EFIAPI *EFI_ADD_IO_SPACE) (
264   IN EFI_GCD_IO_TYPE       GcdIoType,
265   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
266   IN UINT64                Length
267   )
268 /*++
269 
270 Routine Description:
271 
272   Adds reserved I/O or I/O resources to the global coherency domain of the processor.
273 
274 Arguments:
275 
276   GcdIoType         - IO type of the segment.
277 
278   BaseAddress       - Base address of the segment.
279 
280   Length            - Length of the segment.
281 
282 Returns:
283 
284   EFI_SUCCESS       - Merged this segment into GCD map.
285 
286 --*/
287 ;
288 
289 typedef
290 EFI_BOOTSERVICE
291 EFI_STATUS
292 (EFIAPI *EFI_ALLOCATE_IO_SPACE) (
293   IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
294   IN     EFI_GCD_IO_TYPE                     GcdIoType,
295   IN     UINTN                               Alignment,
296   IN     UINT64                              Length,
297   IN OUT EFI_PHYSICAL_ADDRESS                * BaseAddress,
298   IN     EFI_HANDLE                          ImageHandle,
299   IN     EFI_HANDLE                          DeviceHandle OPTIONAL
300   )
301 /*++
302 
303 Routine Description:
304 
305   Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
306 domain of the processor.
307 
308 Arguments:
309 
310   GcdAllocateType   - The type of allocate operation
311 
312   GcdIoType         - The desired IO type
313 
314   Alignment         - Align with 2^Alignment
315 
316   Length            - Length to allocate
317 
318   BaseAddress       - Base address to allocate
319 
320   Imagehandle       - The image handle consume the allocated space.
321 
322   DeviceHandle      - The device handle consume the allocated space.
323 
324 Returns:
325 
326   EFI_INVALID_PARAMETER       - Invalid parameter.
327 
328   EFI_NOT_FOUND               - No descriptor contains the desired space.
329 
330   EFI_SUCCESS                 - IO space successfully allocated.
331 
332 --*/
333 ;
334 
335 typedef
336 EFI_BOOTSERVICE
337 EFI_STATUS
338 (EFIAPI *EFI_FREE_IO_SPACE) (
339   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
340   IN UINT64                Length
341   )
342 /*++
343 
344 Routine Description:Routine Description:
345 
346   Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
347 domain of the processor.
348 
349 Arguments:
350 
351   BaseAddress       - Base address of the segment.
352 
353   Length            - Length of the segment.
354 
355 Returns:
356 
357   EFI_SUCCESS       - Space successfully freed.
358 
359 --*/
360 ;
361 
362 typedef
363 EFI_BOOTSERVICE
364 EFI_STATUS
365 (EFIAPI *EFI_REMOVE_IO_SPACE) (
366   IN EFI_PHYSICAL_ADDRESS  BaseAddress,
367   IN UINT64                Length
368   )
369 /*++
370 
371 Routine Description:Routine Description:
372 
373   Removes reserved I/O or I/O resources from the global coherency domain of the
374 processor.
375 
376 Arguments:
377 
378   BaseAddress       - Base address of the segment.
379 
380   Length            - Length of the segment.
381 
382 Returns:
383 
384   EFI_SUCCESS       - Successfully removed a segment of IO space.
385 
386 --*/
387 ;
388 
389 typedef
390 EFI_BOOTSERVICE
391 EFI_STATUS
392 (EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR) (
393   IN  EFI_PHYSICAL_ADDRESS         BaseAddress,
394   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  * Descriptor
395   )
396 /*++
397 
398 Routine Description:
399 
400   Retrieves the descriptor for an I/O region containing a specified address.
401 
402 Arguments:
403 
404   BaseAddress       - Specified start address
405 
406   Descriptor        - Specified length
407 
408 Returns:
409 
410   EFI_INVALID_PARAMETER       - Descriptor is NULL.
411 
412   EFI_SUCCESS                 - Successfully get the IO space descriptor.
413 
414 --*/
415 ;
416 
417 typedef
418 EFI_BOOTSERVICE
419 EFI_STATUS
420 (EFIAPI *EFI_GET_IO_SPACE_MAP) (
421   OUT UINTN                        *NumberOfDescriptors,
422   OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap
423   )
424 /*++
425 
426 Routine Description:
427 
428   Returns a map of the I/O resources in the global coherency domain of the processor.
429 
430 Arguments:
431 
432   NumberOfDescriptors       - Number of descriptors.
433 
434   MemorySpaceMap            - Descriptor array
435 
436 Returns:
437 
438   EFI_INVALID_PARAMETER     - Invalid parameter
439 
440   EFI_OUT_OF_RESOURCES      - No enough buffer to allocate
441 
442   EFI_SUCCESS               - Successfully get IO space map.
443 
444 --*/
445 ;
446 
447 typedef
448 EFI_BOOTSERVICE
449 EFI_STATUS
450 (EFIAPI *EFI_DISPATCH) (VOID)
451 /*++
452 
453 Routine Description:
454 
455   Loads and executed DXE drivers from firmware volumes.
456 
457 Arguments:
458 
459   None
460 
461 Returns:
462 
463   Status code
464 
465 --*/
466 ;
467 
468 typedef
469 EFI_BOOTSERVICE
470 EFI_STATUS
471 (EFIAPI *EFI_SCHEDULE) (
472   IN EFI_HANDLE  FirmwareVolumeHandle,
473   IN EFI_GUID    * DriverName
474   )
475 /*++
476 
477 Routine Description:
478 
479   Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
480 
481 Arguments:
482 
483   FirmwareVolumeHandle  - The handle of the firmware volume that contains the file specified by FileName.
484 
485   DriverName            - A pointer to the name of the file in a firmware volume.
486 
487 Returns:
488 
489   Status code
490 
491 --*/
492 ;
493 
494 typedef
495 EFI_BOOTSERVICE
496 EFI_STATUS
497 (EFIAPI *EFI_TRUST) (
498   IN EFI_HANDLE  FirmwareVolumeHandle,
499   IN EFI_GUID    * DriverName
500   )
501 /*++
502 
503 Routine Description:
504 
505   Promotes a file stored in a firmware volume from the untrusted to the trusted state.
506 
507 Arguments:
508 
509   FirmwareVolumeHandle  - The handle of the firmware volume that contains the file specified by FileName.
510 
511   DriverName            - A pointer to the name of the file in a firmware volume.
512 
513 Returns:
514 
515   Status code
516 
517 --*/
518 ;
519 
520 typedef
521 EFI_BOOTSERVICE
522 EFI_STATUS
523 (EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME) (
524   IN VOID                             *FvHeader,
525   IN UINTN                            Size,
526   OUT EFI_HANDLE                      * FirmwareVolumeHandle
527   )
528 /*++
529 
530 Routine Description:
531 
532   Creates a firmware volume handle for a firmware volume that is present in system memory.
533 
534 Arguments:
535 
536   FirmwareVolumeHeader    - A pointer to the header of the firmware volume.
537   Size                    - The size, in bytes, of the firmware volume.
538   FirmwareVolumeHandle    - On output, a pointer to the created handle.
539 
540 Returns:
541 
542   Status code
543 
544 --*/
545 ;
546 
547 //
548 // DXE Services Table
549 //
550 #define EFI_DXE_SERVICES_SIGNATURE  0x565245535f455844
551 #if (PI_SPECIFICATION_VERSION < 0x00010000)
552 #define EFI_DXE_SERVICES_REVISION   ((0 << 16) | (90))
553 #else
554 #define EFI_DXE_SERVICES_REVISION   ((1 << 16) | (00))
555 #endif
556 
557 typedef struct {
558   EFI_TABLE_HEADER                Hdr;
559 
560   //
561   // Global Coherency Domain Services
562   //
563   EFI_ADD_MEMORY_SPACE            AddMemorySpace;
564   EFI_ALLOCATE_MEMORY_SPACE       AllocateMemorySpace;
565   EFI_FREE_MEMORY_SPACE           FreeMemorySpace;
566   EFI_REMOVE_MEMORY_SPACE         RemoveMemorySpace;
567   EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
568   EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
569   EFI_GET_MEMORY_SPACE_MAP        GetMemorySpaceMap;
570   EFI_ADD_IO_SPACE                AddIoSpace;
571   EFI_ALLOCATE_IO_SPACE           AllocateIoSpace;
572   EFI_FREE_IO_SPACE               FreeIoSpace;
573   EFI_REMOVE_IO_SPACE             RemoveIoSpace;
574   EFI_GET_IO_SPACE_DESCRIPTOR     GetIoSpaceDescriptor;
575   EFI_GET_IO_SPACE_MAP            GetIoSpaceMap;
576 
577   //
578   // Dispatcher Services
579   //
580   EFI_DISPATCH                    Dispatch;
581   EFI_SCHEDULE                    Schedule;
582   EFI_TRUST                       Trust;
583   //
584   // Service to process a single firmware volume found in a capsule
585   //
586   EFI_PROCESS_FIRMWARE_VOLUME     ProcessFirmwareVolume;
587 } EFI_DXE_SERVICES;
588 
589 #endif
590