1// Copyright 2016 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#include <stdint.h>
8
9#include <efi/types.h>
10#include <efi/boot-services.h>
11#include <efi/runtime-services.h>
12#include <efi/protocol/simple-text-input.h>
13#include <efi/protocol/simple-text-output.h>
14
15#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249
16#define EFI_2_60_SYSTEM_TABLE_REVISION ((2<<16) | (60))
17#define EFI_2_50_SYSTEM_TABLE_REVISION ((2<<16) | (50))
18#define EFI_2_40_SYSTEM_TABLE_REVISION ((2<<16) | (40))
19#define EFI_2_31_SYSTEM_TABLE_REVISION ((2<<16) | (31))
20#define EFI_2_30_SYSTEM_TABLE_REVISION ((2<<16) | (30))
21#define EFI_2_20_SYSTEM_TABLE_REVISION ((2<<16) | (20))
22#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10))
23#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00))
24#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))
25#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))
26#define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
27#define EFI_SYSTEM_TABLE_REVISION EFI_2_60_SYSTEM_TABLE_REVISION
28
29typedef struct {
30    efi_guid VendorGuid;
31    void* VendorTable;
32} efi_configuration_table;
33
34typedef struct efi_system_table {
35    efi_table_header Hdr;
36    char16_t* FirmwareVendor;
37    uint32_t FirmwareRevision;
38    efi_handle ConsoleInHandle;
39    efi_simple_text_input_protocol* ConIn;
40    efi_handle ConsoleOutHandle;
41    efi_simple_text_output_protocol* ConOut;
42    efi_handle StandardErrorHandle;
43    efi_simple_text_output_protocol* StdErr;
44    efi_runtime_services *RuntimeServices;
45    efi_boot_services* BootServices;
46    size_t NumberOfTableEntries;
47    efi_configuration_table *ConfigurationTable;
48} efi_system_table;
49