VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Include/DevEFI.h@ 44529

Last change on this file since 44529 was 44529, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: DevEFI.h 44529 2013-02-04 15:54:15Z vboxsync $ */
2/** @file
3 * EFI for VirtualBox Common Definitions.
4 *
5 * WARNING: This header is used by both firmware and VBox device,
6 * thus don't put anything here but numeric constants or helper
7 * inline functions.
8 */
9
10/*
11 * Copyright (C) 2009-2012 Oracle Corporation
12 *
13 * This file is part of VirtualBox Open Source Edition (OSE), as
14 * available from http://www.virtualbox.org. This file is free software;
15 * you can redistribute it and/or modify it under the terms of the GNU
16 * General Public License (GPL) as published by the Free Software
17 * Foundation, in version 2 as it comes in the "COPYING" file of the
18 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
19 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
20 */
21
22#ifndef ___EFI_VBoxEFI_h
23#define ___EFI_VBoxEFI_h
24
25#include <iprt/assert.h>
26
27/** @defgroup grp_devefi DevEFI <-> Firmware Interfaces
28 * @{
29 */
30
31/** The base of the I/O ports used for interaction between the EFI firmware and DevEFI. */
32#define EFI_PORT_BASE 0xEF10
33/** The number of ports. */
34#define EFI_PORT_COUNT 0x0006
35
36
37/** Information querying.
38 * 32-bit write sets the info index and resets the reading, see EfiInfoIndex.
39 * 32-bit read returns the size of the info (in bytes).
40 * 8-bit reads returns the info as a byte sequence. */
41#define EFI_INFO_PORT (EFI_PORT_BASE+0x0)
42/** Information requests.
43 * @todo Put this in DEVEFIINFO, that's much easier to access. */
44typedef enum
45{
46 EFI_INFO_INDEX_INVALID = 0,
47 EFI_INFO_INDEX_VOLUME_BASE,
48 EFI_INFO_INDEX_VOLUME_SIZE,
49 EFI_INFO_INDEX_TEMPMEM_BASE,
50 EFI_INFO_INDEX_TEMPMEM_SIZE,
51 EFI_INFO_INDEX_STACK_BASE,
52 EFI_INFO_INDEX_STACK_SIZE,
53 EFI_INFO_INDEX_BOOT_ARGS,
54 EFI_INFO_INDEX_DEVICE_PROPS,
55 EFI_INFO_INDEX_FSB_FREQUENCY,
56 EFI_INFO_INDEX_CPU_FREQUENCY,
57 EFI_INFO_INDEX_TSC_FREQUENCY,
58 EFI_INFO_INDEX_GOP_MODE,
59 EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION,
60 EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION,
61#ifdef VBOX_WITH_OVMF
62
63#endif
64 EFI_INFO_INDEX_END
65} EfiInfoIndex;
66
67/** Panic port.
68 * Write causes action to be taken according to the value written,
69 * see the EFI_PANIC_CMD_* defines below.
70 * Reading from the port has no effect. */
71#define EFI_PANIC_PORT (EFI_PORT_BASE+0x1)
72/** @defgroup grp_devefi_panic_cmd Panic Commands for EFI_PANIC_PORT
73 * @{ */
74/** Used by the EfiThunk.asm to signal ORG inconsistency. */
75#define EFI_PANIC_CMD_BAD_ORG 1
76/** Used by the EfiThunk.asm to signal unexpected trap or interrupt. */
77#define EFI_PANIC_CMD_THUNK_TRAP 2
78/** Starts a panic message.
79 * Makes sure the panic message buffer is empty. */
80#define EFI_PANIC_CMD_START_MSG 3
81/** Ends a panic message and enters guru meditation state. */
82#define EFI_PANIC_CMD_END_MSG 4
83/** The first panic message command.
84 * The low byte of the command is the char to be added to the panic message. */
85#define EFI_PANIC_CMD_MSG_FIRST 0x4201
86/** The last panic message command. */
87#define EFI_PANIC_CMD_MSG_LAST 0x427f
88/** Makes a panic message command from a char. */
89#define EFI_PANIC_CMD_MSG_FROM_CHAR(ch) (0x4200 | ((ch) & 0x7f) )
90/** Extracts the char from a panic message command. */
91#define EFI_PANIC_CMD_MSG_GET_CHAR(u32) ((u32) & 0x7f)
92/** @} */
93
94/** Undefined port. */
95#define EFI_PORT_UNDEFINED (EFI_PORT_BASE+0x2)
96
97/** Debug logging.
98 * The chars written goes to the log.
99 * Reading has no effect.
100 * @remarks The port number is the same as on of those used by the PC BIOS. */
101#define EFI_DEBUG_PORT (EFI_PORT_BASE+0x3)
102
103#define VBOX_EFI_DEBUG_BUFFER 512
104/** The top of the EFI stack.
105 * The firmware expects a 128KB stack.
106 * @todo Move this to 1MB + 128KB and drop the stack relocation the firmware
107 * does. It expects the stack to be within the temporary memory that
108 * SEC hands to PEI and the VBoxAutoScan PEIM reports. */
109#define VBOX_EFI_TOP_OF_STACK 0x300000
110
111#define EFI_VARIABLE_OP (EFI_PORT_BASE+0x4)
112#define EFI_VARIABLE_PARAM (EFI_PORT_BASE+0x5)
113
114#define EFI_VARIABLE_OP_QUERY 0xdead0001
115#define EFI_VARIABLE_OP_QUERY_NEXT 0xdead0002
116#define EFI_VARIABLE_OP_ADD 0xdead0010
117
118#define EFI_VARIABLE_OP_STATUS_OK 0xcafe0000
119#define EFI_VARIABLE_OP_STATUS_ERROR 0xcafe0001
120#define EFI_VARIABLE_OP_STATUS_NOT_FOUND 0xcafe0002
121#define EFI_VARIABLE_OP_STATUS_NOT_WP 0xcafe0003
122#define EFI_VARIABLE_OP_STATUS_BSY 0xcafe0010
123
124#define EFI_VARIABLE_NAME_MAX 1024
125#define EFI_VARIABLE_VALUE_MAX 1024
126
127typedef enum {
128 EFI_VM_VARIABLE_OP_START = 0,
129 EFI_VM_VARIABLE_OP_END,
130 EFI_VM_VARIABLE_OP_INDEX,
131 EFI_VM_VARIABLE_OP_GUID,
132 EFI_VM_VARIABLE_OP_ATTRIBUTE,
133 EFI_VM_VARIABLE_OP_NAME,
134 EFI_VM_VARIABLE_OP_NAME_LENGTH,
135 EFI_VM_VARIABLE_OP_VALUE,
136 EFI_VM_VARIABLE_OP_VALUE_LENGTH,
137 EFI_VM_VARIABLE_OP_MAX
138} EFIVAROP;
139
140/**
141 * DevEFI Info stored at DEVEFI_INFO_PHYS_ADDR
142 */
143typedef struct DEVEFIINFO
144{
145 /** 0x00 - The physical address of the firmware entry point. */
146 uint32_t pfnFirmwareEP;
147 /** 0x04 - Spaced reserved for the high part of a 64-bit entrypoint address. */
148 uint32_t HighEPAddress;
149 /** 0x08 - The address of the firmware volume. */
150 RTGCPHYS PhysFwVol;
151 /** 0x10 - The size of the firmware volume. */
152 uint32_t cbFwVol;
153 /** 0x14 - Amount of memory below 4GB (in bytes). */
154 uint32_t cbBelow4GB;
155 /** 0x18 - Amount of memory above 4GB (in bytes). */
156 uint64_t cbAbove4GB;
157 /** 0x20 - see flags values below */
158 uint32_t fFlags;
159 /** 0x24 - The nubmer of Virtual CPUs. */
160 uint32_t cCpus;
161 /** 0x28 - Reserved for future use, must be zero. */
162 uint32_t pfnPeiEP;
163 /** 0x2c - Reserved for future use, must be zero. */
164 uint32_t u32Reserved2;
165} DEVEFIINFO;
166AssertCompileSize(DEVEFIINFO, 0x30);
167/** Pointer to a DevEFI info structure. */
168typedef DEVEFIINFO *PDEVEFIINFO;
169/** Pointer to a const DevEFI info structure. */
170typedef DEVEFIINFO const *PCDEVEFIINFO;
171
172/** The physical address where DEVEFIINFO can be found. */
173#define DEVEFI_INFO_PHYS_ADDR (0xfffff000)
174#define DEVEFI_INFO_FLAGS_AMD64 RT_BIT(0)
175
176/** @} */
177
178#define KB(x) ((x) * 1024)
179#define MB(x) ((KB(x)) * 1024)
180
181#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette