Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.c	(revision 26438)
@@ -0,0 +1,132 @@
+/* $Id$ */
+/** @file
+ * VBoxDebugLib.c - Debug logging and assertions support routines using DevEFI.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Base.h>
+#include <Library/PrintLib.h>
+#include <Library/DebugLib.h>
+
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+
+
+
+VOID EFIAPI
+DebugPrint(IN UINTN ErrorLevel, IN CONST CHAR8 *Format, ...)
+{
+    CHAR8       szBuf[256];
+    VA_LIST     va;
+    UINTN       cch;
+    RTCCUINTREG SavedFlags;
+
+    /* No pool noise, please. */
+    if (ErrorLevel == DEBUG_POOL)
+        return;
+
+    VA_START(va, Format);
+    cch = AsciiVSPrint(szBuf, sizeof(szBuf), Format, va);
+    VA_END(va);
+
+    /* make sure it's terminated and doesn't end with a newline */
+    if (cch >= sizeof(szBuf))
+        cch = sizeof(szBuf) - 1;
+    while (cch > 0 && (szBuf[cch - 1] == '\n' || szBuf[cch - 1] == '\r'))
+        cch--;
+    szBuf[cch] = '\0';
+
+    SavedFlags = ASMIntDisableFlags();
+
+    VBoxPrintString("dbg/");
+    VBoxPrintHex(ErrorLevel, sizeof(ErrorLevel));
+    VBoxPrintChar(' ');
+    VBoxPrintString(szBuf);
+    VBoxPrintChar('\n');
+
+    ASMSetFlags(SavedFlags);
+
+}
+
+
+VOID EFIAPI
+DebugAssert(IN CONST CHAR8 *FileName, IN UINTN LineNumber, IN CONST CHAR8 *Description)
+{
+    RTCCUINTREG SavedFlags = ASMIntDisableFlags();
+
+    VBoxPrintString("EFI Assertion failed! File=");
+    VBoxPrintString(FileName ? FileName : "<NULL>");
+    VBoxPrintString(" line=0x");
+    VBoxPrintHex(LineNumber, sizeof(LineNumber));
+    VBoxPrintString("\nDescription: ");
+    VBoxPrintString(Description ? Description : "<NULL>");
+
+    ASMOutU8(EFI_PANIC_PORT, 2); /** @todo fix this. */
+
+    ASMSetFlags(SavedFlags);
+}
+
+
+VOID * EFIAPI
+DebugClearMemory(OUT VOID *Buffer, IN UINTN Length)
+{
+    return Buffer;
+}
+
+
+BOOLEAN EFIAPI
+DebugAssertEnabled(VOID)
+{
+    return TRUE;
+}
+
+
+BOOLEAN EFIAPI
+DebugPrintEnabled(VOID)
+{
+    /** @todo some PCD for this so we can disable it in release builds. */
+    return TRUE;
+}
+
+
+BOOLEAN EFIAPI
+DebugCodeEnabled(VOID)
+{
+    /** @todo ditto */
+    return TRUE;
+}
+
+
+BOOLEAN EFIAPI
+DebugClearMemoryEnabled(VOID)
+{
+    return FALSE;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf	(revision 26438)
@@ -0,0 +1,76 @@
+# $Id$
+## @file
+# VBoxDebugLib - Debug logging and assertions support routines using DevEFI.
+#
+
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+
+
+[Defines]
+        INF_VERSION                = 0x00010005
+        BASE_NAME                  = VBoxDebugLib
+        FILE_GUID                  = 549306AB-75C1-4585-8681-556EBB34C60C
+        MODULE_TYPE                = BASE
+        VERSION_STRING             = 1.0
+        LIBRARY_CLASS              = DebugLib
+
+[Sources.common]
+        VBoxDebugLib.c
+        VBoxPrintChar.c
+        VBoxPrintGuid.c
+        VBoxPrintHex.c
+        VBoxPrintHexDump.c
+        VBoxPrintString.c
+
+[Packages]
+        MdePkg/MdePkg.dec
+        VBoxPkg/VBoxPkg.dec
+
+[LibraryClasses]
+        BaseLib
+        BaseMemoryLib
+        PrintLib
+
+[Guids]
+        # none
+
+[Ppis]
+        # none
+
+[Guids]
+        # none
+
+[Pcd.common]
+        # none
+
+[FixedPcd.common]
+        # none
+
+[FeaturePcd.common]
+        # none
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintChar.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintChar.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintChar.c	(revision 26438)
@@ -0,0 +1,48 @@
+/* $Id$ */
+/** @file
+ * VBoxPrintChar.c - Implementation of the VBoxPrintChar() debug logging routine.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+
+
+/**
+ * Prints a char.
+ * @returns 1
+ * @param   ch              The char to print.
+ */
+size_t VBoxPrintChar(int ch)
+{
+    ASMOutU8(EFI_DEBUG_PORT, (uint8_t)ch);
+    return 1;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintGuid.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintGuid.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintGuid.c	(revision 26438)
@@ -0,0 +1,67 @@
+/* $Id$ */
+/** @file
+ * VBoxPrintGuid.c - Implementation of the VBoxPrintGuid() debug logging routine.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+
+
+/**
+ * Prints a EFI GUID.
+ *
+ * @returns Number of bytes printed.
+ *
+ * @param   pGuid           The GUID to print
+ */
+size_t VBoxPrintGuid(CONST EFI_GUID *pGuid)
+{
+    VBoxPrintHex(pGuid->Data1, sizeof(pGuid->Data1));
+    VBoxPrintChar('-');
+    VBoxPrintHex(pGuid->Data2, sizeof(pGuid->Data2));
+    VBoxPrintChar('-');
+    VBoxPrintHex(pGuid->Data3, sizeof(pGuid->Data3));
+    VBoxPrintChar('-');
+    VBoxPrintHex(pGuid->Data4[0], sizeof(pGuid->Data4[0]));
+    VBoxPrintHex(pGuid->Data4[1], sizeof(pGuid->Data4[1]));
+    VBoxPrintChar('-');
+    VBoxPrintHex(pGuid->Data4[2], sizeof(pGuid->Data4[2]));
+    VBoxPrintHex(pGuid->Data4[3], sizeof(pGuid->Data4[3]));
+    VBoxPrintHex(pGuid->Data4[4], sizeof(pGuid->Data4[4]));
+    VBoxPrintHex(pGuid->Data4[5], sizeof(pGuid->Data4[5]));
+    VBoxPrintHex(pGuid->Data4[6], sizeof(pGuid->Data4[6]));
+    VBoxPrintHex(pGuid->Data4[7], sizeof(pGuid->Data4[7]));
+    return 37;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHex.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHex.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHex.c	(revision 26438)
@@ -0,0 +1,87 @@
+/* $Id$ */
+/** @file
+ * VBoxPrintHex.c - Implementation of the VBoxPrintHex() debug logging routine.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+
+
+/**
+ * Prints a char.
+ * @param   ch              The char to print.
+ */
+DECLINLINE(void) vboxPrintHexChar(int ch)
+{
+    ASMOutU8(EFI_DEBUG_PORT, (uint8_t)ch);
+}
+
+
+/**
+ * Print a hex number, up to 64-bit long.
+ *
+ * @returns Number of chars printed.
+ *
+ * @param   uValue          The value.
+ * @param   cbType          The size of the value type.
+ */
+size_t VBoxPrintHex(UINT64 uValue, size_t cbType)
+{
+    static const char s_szHex[17] = "0123456789abcdef";
+    switch (cbType)
+    {
+        case 8:
+            vboxPrintHexChar(s_szHex[(uValue >> 60) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 56) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 52) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 48) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 44) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 40) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 36) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 32) & 0xf]);
+        case 4:
+            vboxPrintHexChar(s_szHex[(uValue >> 28) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 24) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 20) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >> 16) & 0xf]);
+        case 2:
+            vboxPrintHexChar(s_szHex[(uValue >> 12) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue >>  8) & 0xf]);
+        case 1:
+            vboxPrintHexChar(s_szHex[(uValue >>  4) & 0xf]);
+            vboxPrintHexChar(s_szHex[(uValue      ) & 0xf]);
+            break;
+    }
+    return cbType * 2;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHexDump.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHexDump.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxDebugLib/VBoxPrintHexDump.c	(revision 26438)
@@ -0,0 +1,106 @@
+/* $Id$ */
+/** @file
+ * VBoxPrintHex.c - Implementation of the VBoxPrintHex() debug logging routine.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+#include <iprt/ctype.h>
+
+
+/**
+ * Prints a char.
+ * @returns 1.
+ * @param   ch              The char to print.
+ */
+DECLINLINE(int) vboxPrintHexDumpChar(int ch)
+{
+    ASMOutU8(EFI_DEBUG_PORT, (uint8_t)ch);
+    return 1;
+}
+
+
+/**
+ * Prints a hex dump the specified memory block.
+ *
+ * @returns Number of bytes printed.
+ *
+ * @param   pv      The memory to dump.
+ * @param   cb      Number of bytes to dump.
+ */
+size_t VBoxPrintHexDump(const void *pv, size_t cb)
+{
+    size_t          cchPrinted = 0;
+    uint8_t const  *pb         = (uint8_t const *)pv;
+    while (cb > 0)
+    {
+        unsigned i;
+
+        /* the offset */
+        cchPrinted += VBoxPrintHex((uintptr_t)pb, sizeof(pb));
+        cchPrinted += VBoxPrintString("  ");
+
+        /* the hex bytes value. */
+        for (i = 0; i < 16; i++)
+        {
+            cchPrinted += vboxPrintHexDumpChar(i == 7 ? '-' : ' ');
+            if (i < cb)
+                cchPrinted += VBoxPrintHex(pb[i], 1);
+            else
+                cchPrinted += VBoxPrintString("  ");
+        }
+
+        /* the printable chars */
+        cchPrinted += VBoxPrintString("  ");
+        for (i = 0; i < 16 && i < cb; i++)
+            cchPrinted += vboxPrintHexDumpChar(pb[i] == ' '
+                                               ? ' '
+                                               : RT_C_IS_GRAPH(pb[i])
+                                               ? pb[i]
+                                               : '.');
+
+        /* finally, the new line. */
+        cchPrinted += vboxPrintHexDumpChar('\n');
+
+        /*
+         * Advance.
+         */
+        if (cb <= 16)
+            break;
+        cb -= 16;
+        pb += 16;
+    }
+
+    return cchPrinted;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.c	(revision 26438)
@@ -0,0 +1,212 @@
+/* $Id$ */
+/** @file
+ * DxeVBoxOemHookStatusCodeLib.c - Logging.
+ */
+
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/OemHookStatusCodeLib.h>
+#include <Library/PrintLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Guid/StatusCodeDataTypeId.h>
+#include <Guid/StatusCodeDataTypeDebug.h>
+#if 0 /* See VBoxSecExtractDebugInfo */
+# include <DebugInfo.h>
+#endif
+
+#include "VBoxDebugLib.h"
+#include "DevEFI.h"
+
+
+
+EFI_STATUS EFIAPI
+OemHookStatusCodeInitialize(VOID)
+{
+    VBoxPrintString("OemHookStatusCodeInitialize\n");
+    return EFI_SUCCESS;
+}
+
+
+#if 0 /* vvl: With thbe new version the API changed a bit and VA_LIST isn't used any more. Before applying
+       *      any changes here I would like to understand in which cases we need this help function.
+       * bird: Some components sent information in this format. Search for the UUID or EFI_DEBUG_INFO usage.
+       */
+/**
+ * Helper VBoxSecPeiReportStatusCode uses for catching some odd reports.
+ */
+static BOOLEAN
+VBoxSecExtractDebugInfo(IN CONST EFI_STATUS_CODE_DATA *pData,
+                        OUT UINT32 *puErrorLevel,
+                        OUT VA_LIST *pVa,
+                        OUT CHAR8 **ppszFormat)
+{
+    EFI_DEBUG_INFO *pDebugInfo;
+
+    if (    !CompareGuid(&pData->Type, &gEfiStatusCodeSpecificDataGuid)
+        ||  pData->HeaderSize != sizeof(*pData)
+        ||  pData->Size <= sizeof(UINT64) * 12 + sizeof(EFI_DEBUG_INFO) + 1)
+        return FALSE;
+
+    pDebugInfo  = (EFI_DEBUG_INFO *)(pData + 1);
+    *pVa        = (VA_LIST)(pDebugInfo + 1);
+    *ppszFormat = (CHAR8 *)((UINT64 *)pVa + 12);
+    return TRUE;
+}
+#endif
+
+/** Worker that dumps the raw data. */
+static void
+VBoxOemHookStatusCodeReportRawDump(EFI_STATUS_CODE_TYPE Type,
+                                   EFI_STATUS_CODE_VALUE Value,
+                                   UINT32 Instance,
+                                   CONST EFI_GUID *CallerId)
+{
+    VBoxPrintString("Report: Type=");
+    VBoxPrintHex(Type, sizeof(Type));
+    VBoxPrintString(" Value=");
+    VBoxPrintHex(Value, sizeof(Value));
+
+    VBoxPrintString(" Instance=");
+    VBoxPrintHex(Instance, sizeof(Instance));
+    if (CallerId)
+    {
+        VBoxPrintString(" CallerId=");
+        VBoxPrintGuid(CallerId);
+    }
+
+#define CASE_PRINT(Head,Print,Tail) \
+        case Head ## Print ## Tail : VBoxPrintString(" " #Print); break
+    switch (Type & EFI_STATUS_CODE_SEVERITY_MASK) /* quick guess work... */
+    {
+        CASE_PRINT(EFI_ERROR_,MINOR,);
+        CASE_PRINT(EFI_ERROR_,MAJOR,);
+        CASE_PRINT(EFI_ERROR_,UNRECOVERED,);
+        CASE_PRINT(EFI_ERROR_,UNCONTAINED,);
+    }
+    switch (Type & EFI_STATUS_CODE_TYPE_MASK) /* quick guess work... */
+    {
+        CASE_PRINT(EFI_,PROGRESS,_CODE);
+        CASE_PRINT(EFI_,ERROR,_CODE);
+        CASE_PRINT(EFI_,DEBUG,_CODE);
+    }
+#undef CASE_PRINT
+    VBoxPrintChar('\n');
+}
+
+
+EFI_STATUS EFIAPI
+OemHookStatusCodeReport(IN EFI_STATUS_CODE_TYPE Type,
+                        IN EFI_STATUS_CODE_VALUE Value,
+                        IN UINT32 Instance,
+                        IN EFI_GUID *CallerId OPTIONAL,
+                        IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
+{
+    /*
+     * Try figure out the data payload
+     */
+    if (Data != NULL)
+    {
+        CHAR8      *pszFilename;
+        CHAR8      *pszDescription;
+        UINT32      uLine;
+        UINT32      uErrorLevel;
+        BASE_LIST   bs;
+        CHAR8      *pszFormat;
+
+        if (ReportStatusCodeExtractAssertInfo(Type, Value, Data, &pszFilename,
+                                              &pszDescription, &uLine))
+        {
+            VBoxPrintString("Assertion Failed! Line=0x");
+            VBoxPrintHex(uLine, sizeof(uLine));
+            if (pszFilename)
+            {
+                VBoxPrintString(" File=");
+                VBoxPrintString(pszFilename);
+            }
+            if (pszDescription)
+            {
+                VBoxPrintString(" Desc=");
+                VBoxPrintString(pszDescription);
+            }
+            VBoxPrintChar('\n');
+        }
+        else if (   ReportStatusCodeExtractDebugInfo(Data, &uErrorLevel, &bs, &pszFormat)
+#if 0 /* See question at VBoxSecExtractDebugInfo. */
+                 || VBoxSecExtractDebugInfo(Data, &uErrorLevel, &va, &pszFormat)
+#endif
+        )
+        {
+            CHAR8   szBuf[128];
+            UINTN   cch;
+
+            cch = AsciiBSPrint(szBuf, sizeof(szBuf), pszFormat, bs);
+            if (cch >= sizeof(szBuf))
+                cch = sizeof(szBuf) - 1;
+            while (     cch > 0
+                   &&   (   szBuf[cch - 1] == '\n'
+                         || szBuf[cch - 1] == '\r'))
+                cch--;
+            szBuf[cch] = '\0';
+
+            VBoxPrintString("DBG/");
+            VBoxPrintHex(uErrorLevel, sizeof(uErrorLevel));
+            VBoxPrintString(": ");
+            VBoxPrintString(szBuf);
+            VBoxPrintChar('\n');
+        }
+        else
+        {
+            /*
+             * Unknown data, resort to raw dump of everything.
+             */
+            VBoxOemHookStatusCodeReportRawDump(Type, Value, Instance, CallerId);
+
+            VBoxPrintString("OemReport: Unknown data type ");
+            VBoxPrintGuid(&Data->Type);
+            VBoxPrintString(" (Size=");
+            VBoxPrintHex(Data->Size, sizeof(Data->Size));
+            VBoxPrintString(" HeaderSize=");
+            VBoxPrintHex(Data->HeaderSize, sizeof(Data->HeaderSize));
+            VBoxPrintString(")\n");
+            if (Data->Size > 0 && Data->Size <= 128)
+                VBoxPrintHexDump(Data + 1, Data->Size);
+        }
+    }
+    /*
+     * No data, do a raw dump.
+     */
+    else
+        VBoxOemHookStatusCodeReportRawDump(Type, Value, Instance, CallerId);
+
+    return EFI_SUCCESS;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf	(revision 26438)
@@ -0,0 +1,74 @@
+# $Id$
+## @file
+# VBoxOemHookStatusCodeLib - Logging.
+#
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+[Defines]
+        INF_VERSION                = 0x00010005
+        BASE_NAME                  = VBoxOemHookStatusCodeLib
+        FILE_GUID                  = 2199AC76-067A-4DFC-B09F-9E8C02CE05B3
+        MODULE_TYPE                = BASE
+        VERSION_STRING             = 1.0
+        LIBRARY_CLASS              = OemHookStatusCodeLib
+        EDK_RELEASE_VERSION        = 0x00020000
+        EFI_SPECIFICATION_VERSION  = 0x00020000
+
+[Sources.common]
+        VBoxOemHookStatusCodeLib.c
+
+[Packages]
+        MdePkg/MdePkg.dec
+        IntelFrameworkPkg/IntelFrameworkPkg.dec
+        IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+        VBoxPkg/VBoxPkg.dec
+
+[LibraryClasses]
+        DebugLib
+        BaseLib
+        BaseMemoryLib
+        ReportStatusCodeLib
+        PrintLib
+
+[Guids]
+        # none
+
+[Ppis]
+        # none
+
+[Guids]
+        # none
+
+[Pcd.common]
+        # none
+
+[FixedPcd.common]
+        # none
+
+[FeaturePcd.common]
+        # none
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c	(revision 26438)
@@ -0,0 +1,133 @@
+/* $Id$ */
+/** @file
+ * VBoxConsole.c - Helper driver waiting for Ready to Boot event to switch graphic mode into user-defined one.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#include "VBoxConsole.h"
+
+/* @todo understand the reasons why TextOutputProtocol.SetMode isn't enough to switch mode. */
+#define VBOX_CONSOLE_VAR L"VBOX_CONSOLE_VAR"
+/*b53865fd-b76c-4433-9e85-c0cadf65aab8*/
+static EFI_GUID gVBoxConsoleVarGuid = { 0xb53865fd, 0xb76c, 0x4433, { 0x9e, 0x85, 0xc0, 0xca, 0xdf, 0x65, 0xaa, 0xb8}};
+
+static EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOutputProtocol; 
+static EFI_GRAPHICS_OUTPUT_PROTOCOL    *Gop;
+static EFI_UGA_DRAW_PROTOCOL           *Uga;
+
+static VOID
+EFIAPI
+ConsoleSwitchMode (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  )
+{
+    EFI_STATUS r = EFI_NOT_FOUND; /* Neither GOP nor UGA is found*/
+    EFI_TPL               OldTpl;
+    OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+    DEBUG((DEBUG_INFO, "%a:%d - SwitchMode\n", __FILE__,  __LINE__));
+    if (Gop)
+        r = Gop->SetMode(Gop, 2);
+    if (Uga)
+        r = Uga->SetMode(Uga, 1024, 768, 32, 60);
+    if(EFI_ERROR(r))
+    {
+        DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        goto done;
+    }
+    r = TextOutputProtocol->SetMode(TextOutputProtocol, TextOutputProtocol->Mode->MaxMode);
+    if(EFI_ERROR(r))
+    {
+        DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        goto done;
+    }
+    done:
+    gBS->RestoreTPL (OldTpl);
+    return;
+}
+
+EFI_STATUS
+EFIAPI
+VBoxConsoleInit(EFI_HANDLE hImage, EFI_SYSTEM_TABLE *pSysTable)
+{
+    EFI_STATUS r;
+    UINT32 val;
+    EFI_EVENT event;
+    UINTN size = sizeof(UINT32);
+    DEBUG((DEBUG_INFO, "%a:%d - STARTING\n", __FILE__,  __LINE__));
+    r = gRT->GetVariable(VBOX_CONSOLE_VAR, &gVBoxConsoleVarGuid, NULL, &size, &val);
+    if (   EFI_ERROR(r)
+        && r == EFI_NOT_FOUND)
+    {
+        size = sizeof(UINT32);
+        val = 1;
+        r = gRT->SetVariable(VBOX_CONSOLE_VAR, &gVBoxConsoleVarGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, size, &val);
+        if (EFI_ERROR(r))
+        {
+            DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+            return r;
+        }
+    
+        r = gBS->LocateProtocol(&gEfiSimpleTextOutProtocolGuid, NULL, (VOID **)&TextOutputProtocol);
+        if(EFI_ERROR(r))
+        {
+            DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        }
+
+        r = gBS->LocateProtocol(&gEfiUgaDrawProtocolGuid, NULL, (VOID **)&Uga);
+        if(EFI_ERROR(r))
+        {
+            DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        }
+        r = gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (VOID **)&Gop);
+        if(EFI_ERROR(r))
+        {
+            DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        }
+        ASSERT((Uga || Gop));
+        r = gBS->CreateEventEx(EVT_NOTIFY_SIGNAL, TPL_NOTIFY, ConsoleSwitchMode, NULL, &gEfiEventReadyToBootGuid, &event);
+        if (EFI_ERROR(r))
+        {
+            DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+            return r;
+        }
+        return r;
+    }
+    if (!EFI_ERROR(r))
+    {
+        return EFI_ALREADY_STARTED;
+    }
+    return r;
+}
+
+EFI_STATUS
+EFIAPI
+VBoxConsoleFini(EFI_HANDLE hImage)
+{
+    return EFI_SUCCESS;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.h	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsole.h	(revision 26438)
@@ -0,0 +1,43 @@
+/* $Id$ */
+/** @file
+ * VBoxConsole.h - Some declarations.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#ifndef __VBOXCONSOLE_H__
+#define __VBOXCONSOLE_H__
+#include <Uefi.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Protocol/SimpleTextOut.h>
+#include <Guid/EventGroup.h>
+#include <Protocol/GraphicsOutput.h>
+#include <Protocol/UgaDraw.h>
+#endif
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf	(revision 26438)
@@ -0,0 +1,78 @@
+# $Id$
+## @file
+# VBoxConsole.inf - VBoxConsoleDxe module declarations.
+#
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = VBoxConsoleDxe
+  FILE_GUID                      = 63330037-c9a0-498f-a539-b54c9141f4ca
+  MODULE_TYPE                    = UEFI_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = VBoxConsoleInit
+  UNLOAD_IMAGE                    = VBoxConsoleFini
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+  VBoxConsole.c
+[Packages]
+  VBoxPkg/VBoxPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+
+[LibraryClasses]
+  BaseLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiRuntimeServicesTableLib
+  BaseMemoryLib
+  DebugLib
+  HiiLib
+  PrintLib
+
+[Guids]
+    gEfiEventExitBootServicesGuid
+[Protocols]
+  gEfiSimpleTextOutProtocolGuid                 ## CONSUMES
+  gEfiVariableArchProtocolGuid                  ## CONSUMES
+  gEfiGraphicsOutputProtocolGuid
+  gEfiUgaDrawProtocolGuid
+
+
+[Depex]
+  gEfiSimpleTextOutProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxLogo/VBoxLogo.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxLogo/VBoxLogo.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxLogo/VBoxLogo.inf	(revision 26438)
@@ -0,0 +1,30 @@
+# $Id$
+
+#* @file
+# VBoxLogo.inf - Logo module declarations.
+#
+
+#
+# Copyright (C) 2009.2010 Sun Microsystems, Inc.
+#
+# Sun Microsystems, Inc. confidential
+# All rights reserved
+#
+**/
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = VBoxLogo
+  FILE_GUID                      = 323afebe-cc60-11de-af38-4731b4e5bd74
+  MODULE_TYPE                    = USER_DEFINED
+  VERSION_STRING                 = 1.0
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
+#
+
+[Binaries.common]
+  BIN|VBoxLogo.bmp|*
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.c	(revision 26438)
@@ -0,0 +1,149 @@
+/* $Id$ */
+/** @file
+ * VBoxMimicry.c - Mimic table entry.  
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+#include "VBoxMimicry.h"
+#define VBOX_MIMICRY_VAR L"VBOX_MIMICRY"
+
+/*610467a0-d8a7-11de-a911-87667af93b7d*/
+static EFI_GUID gVBoxMimicryVarGuid = { 0x610467a0, 0xd8a7, 0x11de, {0xa9, 0x11, 0x87, 0x66, 0x7a, 0xf9, 0x3b, 0x7d}};
+
+#define MIM_TBL_ENTRY(name, guid)   DO_9_FAKE_DECL(name) 
+#include "mimic_tbl.h"
+#undef MIM_TBL_ENTRY
+
+#define MIM_TBL_ENTRY(name, guid)           \
+static EFI_GUID gFake ## name = guid;       \
+static void *gFuncArray_ ## name [] =       \
+{                                           \
+    name ## _fake_impl0,                    \
+    name ## _fake_impl1,                    \
+    name ## _fake_impl2,                    \
+    name ## _fake_impl3,                    \
+    name ## _fake_impl4,                    \
+    name ## _fake_impl5,                    \
+    name ## _fake_impl6,                    \
+    name ## _fake_impl7,                    \
+    name ## _fake_impl8,                    \
+    name ## _fake_impl9                     \
+}; 
+#include "mimic_tbl.h"
+#undef MIM_TBL_ENTRY
+
+#define MIM_TBL_ENTRY(name, guid)       \
+FAKE_IMPL(name ## _fake_impl0, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl1, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl2, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl3, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl4, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl5, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl6, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl7, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl8, gFake ## name)    \
+FAKE_IMPL(name ## _fake_impl9, gFake ## name)
+#include "mimic_tbl.h"
+#undef MIM_TBL_ENTRY
+
+
+
+EFI_STATUS
+EFIAPI
+VBoxMimicryInit(EFI_HANDLE hImage, EFI_SYSTEM_TABLE *pSysTable)
+{
+        /* Set'n'check intercept variable */
+        EFI_STATUS r;
+        UINT32 val;
+        UINTN size = sizeof(UINT32);
+        r = gRT->GetVariable(VBOX_MIMICRY_VAR, &gVBoxMimicryVarGuid, NULL, &size, &val);
+        if (   EFI_ERROR(r)
+            && r == EFI_NOT_FOUND)
+        {
+            size = sizeof(UINT32);
+            val = 1;
+            r = gRT->SetVariable(VBOX_MIMICRY_VAR, &gVBoxMimicryVarGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, size, &val);
+            if (EFI_ERROR(r))
+            {
+                DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+                return r;
+            }
+            gThis = AllocateZeroPool(sizeof(VBOXMIMICRY));
+            r = install_mimic_interfaces();
+            if(EFI_ERROR(r))
+            {
+                DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+                return r;
+            }
+            gThis->hImage = hImage;
+            return r;
+        }
+        if (!EFI_ERROR(r))
+        {
+            return EFI_ALREADY_STARTED;
+        }
+        return r;
+}
+
+EFI_STATUS
+EFIAPI
+VBoxMimicryFini(EFI_HANDLE hImage)
+{
+    EFI_STATUS r;
+    uninstall_mimic_interfaces();
+    FreePool(gThis);
+    r = gRT->SetVariable(VBOX_MIMICRY_VAR, &gVBoxMimicryVarGuid, EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL);
+    if (EFI_ERROR(r))
+    {
+        DEBUG((DEBUG_INFO, "%a:%d - %r\n", __FILE__,  __LINE__, r));
+        return r;
+    }
+    return EFI_SUCCESS;
+}
+
+EFI_STATUS install_mimic_interfaces()
+{
+    EFI_STATUS Status;
+    Status = gBS->InstallMultipleProtocolInterfaces (
+    &gThis->hImage,
+#define MIM_TBL_ENTRY(name, guid) gFake##name, gFuncArray_##name,
+#include "mimic_tbl.h"
+#undef MIM_TBL_ENTRY
+    NULL);
+    return Status;
+}
+EFI_STATUS uninstall_mimic_interfaces()
+{
+    EFI_STATUS Status;
+    Status = gBS->InstallMultipleProtocolInterfaces (
+    &gThis->hImage,
+#define MIM_TBL_ENTRY(name, guid) gFake##name,
+#include "mimic_tbl.h"
+#undef MIM_TBL_ENTRY
+    NULL);
+    return Status;
+}
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.h	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicry.h	(revision 26438)
@@ -0,0 +1,69 @@
+/* $Id$ */
+/** @file
+ * VBoxMimicry.h - Debug and logging routines implemented by VBoxDebugLib.
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+#ifndef __VBOXMIMICRY_H__
+#define __VBOXMIMICRY_H__
+#include <Uefi.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+
+#define MIMICRY_INTERFACE_COUNT 1
+#define DO_9_FAKE_DECL(name)        \
+static EFI_STATUS name ## _fake_impl0();  \
+static EFI_STATUS name ## _fake_impl1();  \
+static EFI_STATUS name ## _fake_impl2();  \
+static EFI_STATUS name ## _fake_impl3();  \
+static EFI_STATUS name ## _fake_impl4();  \
+static EFI_STATUS name ## _fake_impl5();  \
+static EFI_STATUS name ## _fake_impl6();  \
+static EFI_STATUS name ## _fake_impl7();  \
+static EFI_STATUS name ## _fake_impl8();  \
+static EFI_STATUS name ## _fake_impl9();
+
+#define FAKE_IMPL(name, guid)                                       \
+static EFI_STATUS name ()                                           \
+{                                                                   \
+    DEBUG((DEBUG_INFO, #name ": of %g called\n", &guid));           \
+    return EFI_SUCCESS;                                             \
+}
+
+typedef struct 
+{
+    EFI_HANDLE hImage;
+} VBOXMIMICRY, *PVBOXMIMICRY;
+
+PVBOXMIMICRY gThis;
+
+EFI_STATUS install_mimic_interfaces();
+EFI_STATUS uninstall_mimic_interfaces();
+#endif
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicryDxe.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicryDxe.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/VBoxMimicryDxe.inf	(revision 26438)
@@ -0,0 +1,77 @@
+# $Id$ */
+#* @file
+# VBoxMimicryDxe.inf - Mimic module declaration.
+
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = VBoxMimicryDxe
+  FILE_GUID                      = f346c474-d8a6-11de-9504-0fc338e40fda
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = VBoxMimicryInit
+  UNLOAD_IMAGE                    = VBoxMimicryFini
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+  VBoxMimicry.c
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+
+[LibraryClasses]
+  BaseLib
+  MemoryAllocationLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiRuntimeServicesTableLib
+  BaseMemoryLib
+  DebugLib
+  HiiLib
+  PrintLib
+
+[Guids]
+  gEfiIfrTianoGuid                              ## CONSUMES ## Guid
+
+[Protocols]
+  gEfiHiiStringProtocolGuid                     ## CONSUMES
+  gEfiHiiConfigRoutingProtocolGuid              ## CONSUMES
+  gEfiHiiConfigAccessProtocolGuid               ## PRODUCES
+  gEfiFormBrowser2ProtocolGuid                  ## CONSUMES
+  gEfiHiiDatabaseProtocolGuid                   ## CONSUMES
+
+
+[Depex]
+  gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/mimic_tbl.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/mimic_tbl.h	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMimicryDxe/mimic_tbl.h	(revision 26438)
@@ -0,0 +1,33 @@
+/* $Id$ */
+/** @file
+ * mimic_tbl.h - Mimic table.  
+ */
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+/*4DF19259-DC71-4D46-BEF1-357BB578C418*/
+#define WIN7_0_GUID {0x4df19259, 0xdc71, 0x4d46, {0xbe, 0xf1, 0x35, 0x7b, 0xb5, 0x78, 0xc4, 0x18}}
+MIM_TBL_ENTRY(win7_0, WIN7_0_GUID)
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/Makefile
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/Makefile	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/Makefile	(revision 26438)
@@ -0,0 +1,59 @@
+# $Id$
+#* @file
+# Makefile - assembling the iso image for experimenting with EFI.
+#/
+#
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+#
+# Here we add modules to be burn on iso-image 
+#
+SOURCES += VBoxInterceptorDxe.efi
+SOURCES += VBoxMimicryDxe.efi
+
+ifeq ($(BUILD_ARCH), IA32)
+ARCH_SUFFIX=
+else
+ARCH_SUFFIX=$(BUILD_ARCH)
+endif
+
+BUILD_ARCH ?= IA32
+BUILD_DIR=$(WORKSPACE)/Build/VBoxPkg$(ARCH_SUFFIX)/DEBUG_UNIXGCC/$(BUILD_ARCH)
+
+ISO_DIR=efi-app
+FILES_TO_ISO=$(foreach file, $(SOURCES), $(addprefix $(ISO_DIR)/, $(file)))
+
+DEST=efi-app.iso
+all:${DEST}
+
+$(DEST):$(FILES_TO_ISO)
+	mkisofs -R -o $@ $(basename $@)
+
+$(ISO_DIR)/%.efi:$(BUILD_DIR)/%.efi
+	cp $< $@
+
+clean:
+	$(RM) -rf ${DEST} $(FILES_TO_ISO)
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/efi-app/Readme.txt
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/efi-app/Readme.txt	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxMisc/efi-app/Readme.txt	(revision 26438)
@@ -0,0 +1,33 @@
+# $Id$ */
+#* @file
+# Readme.txt - Some description about using this module.
+
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+Here could be some help how to manage files on efi-app ISO
+
+VBoxInterceptor - intercepts calls to gBS and gRT, outputs a lot of traffics to dev_efi.e.l2, (please be pacient ;))
+    Shell> load VBoxInterceptor.efi
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dec
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dec	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dec	(revision 26438)
@@ -0,0 +1,82 @@
+# $Id$
+## @file
+# VBoxPkg.dec - VirtualBox Package description.
+#
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+[Defines]
+        DEC_SPECIFICATION       = 0x00010005
+        PACKAGE_NAME            = VBoxPkg
+        PACKAGE_GUID            = D118A5AF-05C8-427E-8047-EF53092514B7
+        PACKAGE_VERSION         = 0.1
+
+[Includes.common]
+        Include
+
+[Guids.common]
+#        gEfiPciExpressBaseAddressGuid = {0x3677d529, 0x326f, 0x4603, {0xa9, 0x26, 0xea, 0xac, 0xe0, 0x1d, 0xcb, 0xb0 }}
+        gEfiAcpiDescriptionGuid       = {0x3c699197, 0x093c, 0x4c69, {0xb0, 0x6b, 0x12, 0x8a, 0xe3, 0x48, 0x1d, 0xc9 }}
+#        gEfiFlashMapHobGuid           = { 0xb091e7d2, 0x5a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59 }}
+        gVBoxVgaPkgTokenSpaceGuid = { 0xa3a8ce56, 0x4a07, 0x441f, {0xa3, 0xf5, 0x6f, 0x53, 0xdb, 0x9c, 0xb7, 0xd8}}
+
+#
+# Various types of Platform Configuration Database (PCD) items.
+#
+[PcdsFixedAtBuild.common]
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0|UINT32|0x00001000
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0|UINT32|0x00001001
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0|UINT32|0x00001002
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0|UINT32|0x00001003
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0|UINT32|0x00001004
+        gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0|UINT32|0x00001005
+
+## XXX - boot mode - gEfiNt32PkgTokenSpaceGuid.PcdWinNtBootMode|1|UINT32|0x00001006
+
+#  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoveryBase|0x0|UINT32|0x00001010
+#  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashFvRecoverySize|0x0|UINT32|0x00001011
+
+#        gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize|0x0|UINT32|0x00001012
+#  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareFdSize|0x0|UINT32|0x00001012
+#  gEfiNt32PkgTokenSpaceGuid.PcdWinNtFirmwareBlockSize|0|UINT32|0x00001013
+
+#        gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageVariableBase|0x0|UINT32|0x00001014
+#        gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwSpareBase|0x0|UINT32|0x00001015
+#        gEfiNt32PkgTokenSpaceGuid.PcdWinNtFlashNvStorageFtwWorkingBase|0x0|UINT32|0x00001016
+#        gEfiNt32PkgTokenSpaceGuid.PcdWinNtFdBaseAddress|0x0|UINT32|0x00001017
+
+[PcdsDynamic.common]
+        # none yet
+
+[PcdsPatchableInModule.common]
+## XXX - boot mode - gEfiNt32PkgTokenSpaceGuid.PcdWinNtBootMode|1|UINT32|0x00001006
+[PcdsFeatureFlag.common]
+        gVBoxVgaPkgTokenSpaceGuid.PcdSupportGop|TRUE|BOOLEAN|0x00010004
+        gVBoxVgaPkgTokenSpaceGuid.PcdSupportUga|FALSE|BOOLEAN|0x00010005
+
+[LibraryClasses]
+  ##  @libraryclass  Generic BDS library definition, include the data structure and function.
+  GenericBdsLib|Include/Library/GenericBdsLib.h
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dsc
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dsc	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.dsc	(revision 26438)
@@ -0,0 +1,423 @@
+# $Id$
+## @file
+# VBoxPkg.dsc - VirtualBox Flash Device.
+#
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+
+# --------------------------------------------------------------------
+#
+# This file is based on: Ovmf/OvmfIA32.dsc
+#/** @file
+#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
+#
+#  Copyright (c) 2006 - 2009, Intel Corporation
+#
+#  All rights reserved. This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+  PLATFORM_NAME                  = VBoxPkg
+  PLATFORM_GUID                  = 5a9e7754-d81b-49ea-85ad-69eaa7b1539b
+  PLATFORM_VERSION               = 0.1
+  DSC_ SPECIFICATION             = 0x00010005
+  OUTPUT_DIRECTORY               = Build/VBoxPkg
+  SUPPORTED_ARCHITECTURES        = IA32
+  BUILD_TARGETS                  = DEBUG|RELEASE
+  SKUID_IDENTIFIER               = DEFAULT
+  FLASH_DEFINITION               = VBoxPkg/VBoxPkg.fdf
+
+################################################################################
+#
+# SKU Identification section - list of all SKU IDs supported by this Platform.
+#
+################################################################################
+[SkuIds]
+  0|DEFAULT
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this Platform.
+#
+################################################################################
+[LibraryClasses.common]
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+  #TimerLib|DuetPkg/Library/DuetTimerLib/DuetTimerLib.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  #PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  PeCoffLib|VBoxPkg/Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
+  PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+  #PciIncompatibleDeviceSupportLib|IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf
+  CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
+  UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  S3Lib|MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf
+  RecoveryLib|MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
+  GenericBdsLib|VBoxPkg/Library/VBoxGenericBdsLib/VBoxGenericBdsLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
+  PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  #OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  OemHookStatusCodeLib|VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf
+  SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
+  MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
+  FileHandleLib|ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.inf
+
+[LibraryClasses.common.SEC]
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+
+[LibraryClasses.common.PEI_CORE]
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+  OemHookStatusCodeLib|VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf
+  #OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+
+[LibraryClasses.common.PEIM]
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+  OemHookStatusCodeLib|VBoxPkg/Library/VBoxOemHookStatusCodeLib/VBoxOemHookStatusCodeLib.inf
+  #OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
+
+[LibraryClasses.common.DXE_CORE]
+  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+  
+[LibraryClasses.common.UEFI_APPLICATION]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
+#
+################################################################################
+[PcdsFeatureFlag.common]
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseHardSerial|TRUE
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
+
+[PcdsFixedAtBuild.common]
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
+  gEfiSioTokenSpaceGuid.PcdSerialRegisterBase|0x3F8
+  gEfiSioTokenSpaceGuid.PcdSerialLineControl|0x07
+  gEfiSioTokenSpaceGuid.PcdSerialBoudRate|115200
+
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x200000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize|0x10000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashFvRecoveryBase|0xFFE00000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashFvRecoverySize|0x00200000
+
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xc000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0xc000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x2000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x10000
+
+  gEfiEdkModulePkgTokenSpaceGuid.PcdDxePcdDatabaseTraverseEnabled|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
+
+[PcdsFeatureFlag.common]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+  gVBoxVgaPkgTokenSpaceGuid.PcdSupportUga|FALSE
+  gVBoxVgaPkgTokenSpaceGuid.PcdSupportGop|TRUE
+
+[PcdsFixedAtBuild.common]
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"VBOX 32"|VOID*
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision|0x10001|UINT32
+
+
+[PcdsDynamicDefault.common]
+  gEfiMdePkgTokenSpaceGuid.PcdFSBClock|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+
+
+################################################################################
+#
+# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsDynamicDefault.common.DEFAULT]
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform.
+#
+################################################################################
+[Components.common]
+  #
+  # SEC Phase modules
+  #
+  OvmfPkg/Sec/SecMain.inf
+
+  #
+  # PEI Phase modules
+  #
+  MdeModulePkg/Core/Pei/PeiMain.inf
+  MdeModulePkg/Universal/PCD/Pei/Pcd.inf  {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+  IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
+    <LibraryClasses>
+      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+  }
+
+  OvmfPkg/PlatformPei/PlatformPei.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+  }
+
+
+  #
+  # DXE Phase modules
+  #
+  MdeModulePkg/Core/Dxe/DxeMain.inf {
+    <LibraryClasses>
+      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+  }
+
+  IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
+  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf  {
+   <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+
+  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
+  UefiCpuPkg/CpuIoDxe/CpuIo.inf
+  UefiCpuPkg/CpuDxe/CpuDxe.inf
+  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  PcAtChipsetPkg/KbcResetDxe/Reset.inf
+  MdeModulePkg/Universal/Metronome/Metronome.inf {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+      #TimerLib|DuetPkg/Library/DuetTimerLib/DuetTimerLib.inf
+  }
+
+  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+      #TimerLib|DuetPkg/Library/DuetTimerLib/DuetTimerLib.inf
+  }
+
+  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf  {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+      #TimerLib|DuetPkg/Library/DuetTimerLib/DuetTimerLib.inf
+  }
+
+  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
+    <LibraryClasses>
+      PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.inf
+  }
+ 
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
+  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+  IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
+  PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+
+  # VBOX
+  VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
+  VBoxPkg/VBoxFsDxe/VBoxHfs.inf
+  VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
+  VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
+  VBoxPkg/VBoxSysTables/VBoxSysTables.inf
+  VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf
+  #VBoxPkg/AcpiTables/AcpiTables.inf
+  # VBOX end
+  IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf
+
+  #
+  # ISA Support
+  #
+  PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
+
+  #
+  # ACPI Support
+  #
+  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+
+  #
+  # This module is for debug purposes (breaks build in Windows host). 
+  # Don't include it to fdf
+  #VBoxPkg/VBoxInterceptorDxe/VBoxInterceptorDxe.inf
+  
+ #
+ # add -DVBOX
+ #
+[BuildOptions.common]
+  GCC:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=32 -DHC_ARCH_BITS=32
+  # 
+  # mingw set 0x4000000 as a default image base that is the reason 
+  # PCD module loaded in the middle of space grub supposed to load
+  # boot images. 
+  # this base address choosen looking at 
+  # Shell> memmap 
+  # in the place where Image.c locates the rest of the modules.
+  GCC:*_*_*_DLINK_FLAGS = --image-base 0x1f000000
+  INTEL:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=32 -DHC_ARCH_BITS=32
+  MSFT:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=32 -DHC_ARCH_BITS=32
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.fdf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.fdf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkg.fdf	(revision 26438)
@@ -0,0 +1,375 @@
+# $Id$
+## @file
+# VBoxPkg.fdf - VirtualBox Flash Device.
+#
+
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#
+
+
+# --------------------------------------------------------------------
+#  This file is based on: Ovmf/Ovmf.fdf
+#
+#  Open Virtual Machine Firmware: FDF
+#
+#  Copyright (c) 2006 - 2009, Intel Corporation
+#
+#  All rights reserved. This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into  the Flash Device Image.  Each FD section
+# defines one flash "device" image.  A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash"  image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+[FD.VBOX]
+BaseAddress   = 0xFFE00000     # The base address of the FLASH Device.
+Size          = 0x001f0000     # The size in bytes of the FLASH Device
+ErasePolarity = 1
+BlockSize     = 0x10000
+NumBlocks     = 0x1f
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+0x0|0x1F0000
+gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoveryBase|gEfiUnixPkgTokenSpaceGuid.PcdUnixFlashFvRecoverySize
+FV = MAINFV
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file.  This section also defines order the components and modules are positioned
+# within the image.  The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+[FV.DXEFV]
+BlockSize          = 0x1000
+FvAlignment        = 16         #FV alignment and FV attributes setting.
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+#
+# Files to be placed in DXEFV
+#
+# This firmware volume will have files placed in it uncompressed,
+# and then then entire firmware volume will be compressed in a
+# single compression operation in order to achieve better
+# overall compression.
+#
+
+APRIORI DXE {
+  INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  INF  IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+}
+
+#
+# DXE Phase modules
+#
+INF  MdeModulePkg/Core/Dxe/DxeMain.inf
+
+INF  IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
+INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+INF  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+INF  IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+INF  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
+INF  UefiCpuPkg/CpuIoDxe/CpuIo.inf
+INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
+INF  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+INF  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
+INF  IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
+INF  MdeModulePkg/Universal/Metronome/Metronome.inf
+INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
+#INF  PcAtChipsetPkg/PcRtc/RealTimeClock.inf
+
+INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
+INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+INF  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+INF  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+INF  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+INF  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+INF  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+INF  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+INF  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+INF  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+INF  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+INF  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
+INF  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+INF  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+INF  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+#INF  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+#INF  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+INF  IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
+INF  PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf
+INF  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+INF  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+
+# VBOX
+INF VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
+INF VBoxPkg/VBoxFsDxe/VBoxHfs.inf
+INF VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
+INF VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
+INF VBoxPkg/VBoxSysTables/VBoxSysTables.inf
+INF VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf
+#INF  RuleOverride=ACPITABLE VBoxPkg/AcpiTables/AcpiTables.inf
+#INF VBoxPkg/VBoxInterceptorDxe/VBoxInterceptorDxe.inf
+# VBOX end
+#INF IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf
+
+INF  PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
+INF  IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
+INF  IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
+INF  IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
+INF  IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
+
+INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+INF  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+
+INF FatBinPkg/EnhancedFatDxe/Fat.inf
+INF EdkShellBinPkg/FullShell/FullShell.inf
+#FILE DRIVER = 961578FE-B6B7-44c3-AF35-6BC705CD2B1F {
+#    SECTION PE32 = FatBinPkg/EnhancedFatDxe/Ia32/Fat.efi
+#  }
+#
+#FILE APPLICATION = c57ad6b7-0515-40a8-9d21-551652854e37 {
+#    SECTION COMPRESS PI_STD {
+#      SECTION GUIDED {
+#        SECTION PE32 = EdkShellBinPkg/FullShell/Ia32/Shell_Full.efi
+#      }
+#    }
+#  }
+
+FILE FREEFORM = 7BB28B99-61BB-11D5-9A5D-0090273FC14D {
+    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { # LzmaCompress
+      SECTION RAW = VBoxPkg/VBoxLogo/VBoxLogo.bmp
+    }
+  }
+
+################################################################################
+
+[FV.MAINFV]
+FvAlignment        = 16
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+#
+# Files to be placed in MAINFV
+#
+# This firmware volume will have all the files placed in it which
+# must not be compressed at the initial boot phase.  The only
+# exception to this is the compressed 'DXEFV'.
+#
+
+APRIORI PEI {
+  INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf
+}
+
+#
+#  SEC Phase modules
+#
+INF  OvmfPkg/Sec/SecMain.inf
+#INF VBoxPkg/VBoxSec/VBoxSec.inf
+
+#
+#  PEI Phase modules
+#
+INF  MdeModulePkg/Core/Pei/PeiMain.inf
+INF  RuleOverride=NORELOC MdeModulePkg/Universal/PCD/Pei/Pcd.inf
+INF  RuleOverride=NORELOC IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
+INF  RuleOverride=NORELOC OvmfPkg/PlatformPei/PlatformPei.inf
+INF  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+
+#
+# This file contains the compressed 'DXEFV', which is compressed
+# in a single compression operation in order to achieve better
+# overall compression.
+#
+FILE FV_IMAGE = 20bc8ac9-94d1-4208-ab28-5d673fd73486 {
+   SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { # LzmaCompress
+      SECTION FV_IMAGE = DXEFV
+   }
+ }
+
+#INF  RuleOverride=RESET_VECTOR OvmfPkg/ResetVector/Bin/ResetVector.inf
+
+################################################################################
+#
+# Rules are use with the [FV] section's module INF type to define
+# how an FFS file is created for a given INF file. The following Rule are the default
+# rules for the different module type. User can add the customized rules to define the
+# content of the FFS file.
+#
+################################################################################
+
+[Rule.Common.PEI_CORE]
+  FILE PEI_CORE = $(NAMED_GUID) {
+    PE32     PE32           |.efi
+    UI       STRING ="$(MODULE_NAME)" Optional
+    VERSION  STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.SEC]
+  FILE SEC = $(NAMED_GUID) {
+    PE32     PE32           |.efi
+    UI       STRING ="$(MODULE_NAME)" Optional
+    VERSION  STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.PEIM]
+  FILE PEIM = $(NAMED_GUID) {
+     PEI_DEPEX PEI_DEPEX Optional        |.depex
+     PE32      PE32   Align=32           |.efi
+     UI       STRING="$(MODULE_NAME)" Optional
+     VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.PEIM.NORELOC]
+  FILE PEIM = $(NAMED_GUID) RELOCS_STRIPPED  {
+     PEI_DEPEX PEI_DEPEX Optional        |.depex
+     TE        TE                        |.efi
+     UI        STRING="$(MODULE_NAME)" Optional
+     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+[Rule.Common.PEIM.TIANOCOMPRESSED]
+  FILE PEIM = $(NAMED_GUID) {
+    PEI_DEPEX PEI_DEPEX Optional         |.depex
+    GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
+      PE32      PE32                     |.efi
+      UI        STRING="$(MODULE_NAME)" Optional
+      VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+    }
+  }
+
+[Rule.Common.DXE_CORE]
+  FILE DXE_CORE = $(NAMED_GUID) {
+    PE32     PE32           |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.UEFI_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32     PE32                    |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.DXE_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32     PE32                    |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.DXE_RUNTIME_DRIVER]
+  FILE DRIVER = $(NAMED_GUID) {
+    DXE_DEPEX    DXE_DEPEX Optional      |.depex
+    PE32     PE32                    |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.UEFI_APPLICATION]
+  FILE APPLICATION = $(NAMED_GUID) {
+    PE32     PE32                    |.efi
+    UI       STRING="$(MODULE_NAME)" Optional
+    VERSION  STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+  }
+
+[Rule.Common.USER_DEFINED.ACPITABLE]
+  FILE FREEFORM = $(NAMED_GUID) {
+    RAW ACPI               |.acpi
+    RAW ASL                |.aml
+  }
+
+[Rule.Common.SEC.RESET_VECTOR]
+  FILE RAW = $(NAMED_GUID) {
+    RAW RAW                |.raw
+  }
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkgX64.dsc
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkgX64.dsc	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxPkgX64.dsc	(revision 26438)
@@ -0,0 +1,385 @@
+# $Id$
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+#/** @file
+#  EFI/Framework Open Virtual Machine Firmware (OVMF) platform
+#
+#  Copyright (c) 2006 - 2009, Intel Corporation
+#
+#  All rights reserved. This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+  PLATFORM_NAME                  = VBoxPkg
+  PLATFORM_GUID                  = 5a9e7754-d81b-49ea-85ad-69eaa7b1539b
+  PLATFORM_VERSION               = 0.1
+  DSC_ SPECIFICATION             = 0x00010005
+  OUTPUT_DIRECTORY               = Build/VBoxPkgX64
+  SUPPORTED_ARCHITECTURES        = X64
+  BUILD_TARGETS                  = DEBUG|RELEASE
+  SKUID_IDENTIFIER               = DEFAULT
+  FLASH_DEFINITION               = VBoxPkg/VBoxPkg.fdf
+
+################################################################################
+#
+# SKU Identification section - list of all SKU IDs supported by this Platform.
+#
+################################################################################
+[SkuIds]
+  0|DEFAULT
+
+################################################################################
+#
+# Library Class section - list of all Library Classes needed by this Platform.
+#
+################################################################################
+[LibraryClasses.common]
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PeCoffLib|VBoxPkg/Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
+  PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+  CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
+  UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  GenericBdsLib|VBoxPkg/Library/VBoxGenericBdsLib/VBoxGenericBdsLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
+  PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
+  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
+  MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
+  FileHandleLib|ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.inf
+
+[LibraryClasses.common.SEC]
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+
+[LibraryClasses.common.PEI_CORE]
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+  OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+
+[LibraryClasses.common.PEIM]
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+  PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
+  OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
+  PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
+
+[LibraryClasses.common.DXE_CORE]
+  HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
+  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  PlatformBdsLib|OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+
+[LibraryClasses.common.UEFI_APPLICATION]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  DebugLib|VBoxPkg/Library/VBoxDebugLib/VBoxDebugLib.inf
+  #DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
+#
+################################################################################
+[PcdsFeatureFlag.common]
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseHardSerial|TRUE
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
+
+[PcdsFixedAtBuild.common]
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
+  gEfiSioTokenSpaceGuid.PcdSerialRegisterBase|0x3F8
+  gEfiSioTokenSpaceGuid.PcdSerialLineControl|0x07
+  gEfiSioTokenSpaceGuid.PcdSerialBoudRate|115200
+
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x200000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize|0x10000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashFvRecoveryBase|0xFFE00000
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashFvRecoverySize|0x00200000
+
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv|32
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x400
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xc000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0xc000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x2000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x10000
+
+  gEfiEdkModulePkgTokenSpaceGuid.PcdDxePcdDatabaseTraverseEnabled|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"VBOX 64"|VOID*
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision|0x10001|UINT32
+
+[PcdsFeatureFlag.common]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+  gOptionRomPkgTokenSpaceGuid.PcdSupportGop|TRUE
+  gOptionRomPkgTokenSpaceGuid.PcdSupportUga|FALSE
+
+[PcdsFixedAtBuild.common]
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
+
+
+################################################################################
+#
+# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsDynamicDefault.common]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
+
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform.
+#
+################################################################################
+[Components.common]
+  #
+  # SEC Phase modules
+  #
+  OvmfPkg/Sec/SecMain.inf
+
+  #
+  # PEI Phase modules
+  #
+  MdeModulePkg/Core/Pei/PeiMain.inf
+  MdeModulePkg/Universal/PCD/Pei/Pcd.inf  {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+  IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
+    <LibraryClasses>
+      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+  }
+
+  OvmfPkg/PlatformPei/PlatformPei.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
+  }
+
+  #
+  # DXE Phase modules
+  #
+  MdeModulePkg/Core/Dxe/DxeMain.inf {
+    <LibraryClasses>
+      NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+  }
+
+  IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.inf
+  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf  {
+   <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+
+  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+  PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
+  UefiCpuPkg/CpuIoDxe/CpuIo.inf
+  UefiCpuPkg/CpuDxe/CpuDxe.inf
+  PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
+  PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  PcAtChipsetPkg/KbcResetDxe/Reset.inf
+  MdeModulePkg/Universal/Metronome/Metronome.inf {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+  }
+
+  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+  }
+
+  IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf  {
+    <LibraryClasses>
+      TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
+  }
+
+  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {
+    <LibraryClasses>
+      PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.inf
+  }
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
+  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+  IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
+  PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+
+  # VBOX
+  VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
+  VBoxPkg/VBoxFsDxe/VBoxHfs.inf
+  VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
+  VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
+  VBoxPkg/VBoxSysTables/VBoxSysTables.inf
+  VBoxPkg/VBoxConsoleDxe/VBoxConsoleDxe.inf
+  #VBoxPkg/AcpiTables/AcpiTables.inf
+  # VBOX end
+
+  #
+  # ISA Support
+  #
+  PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
+  IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
+
+  #
+  # ACPI Support
+  #
+  MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+
+  #
+  # Don't include it to fdf
+  VBoxPkg/VBoxInterceptorDxe/VBoxInterceptorDxe.inf
+  VBoxPkg/VBoxMimicryDxe/VBoxMimicryDxe.inf
+
+[BuildOptions.common]
+  GCC:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=64 -DHC_ARCH_BITS=64
+  GCC:*_*_*_DLINK_FLAGS = --image-base 0x1f000000
+  INTEL:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=64 -DHC_ARCH_BITS=64
+  MSFT:*_*_*_CC_FLAGS = -DVBOX -DARCH_BITS=64 -DHC_ARCH_BITS=64
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.c	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.c	(revision 26438)
@@ -0,0 +1,664 @@
+/* $Id$ */
+/** @file
+ * VBoxVgaMiniPortDxe.c - VgaMiniPort Protocol Implementation.
+ */
+
+
+/*
+ * Copyright (C) 2009,2010 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Protocol/ComponentName.h>
+#include <Protocol/ComponentName2.h>
+#include <Protocol/DriverBinding.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/VgaMiniPort.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <IndustryStandard/Pci22.h>
+
+#include "VBoxPkg.h"
+#include "iprt/asm.h"
+#include "VBoxVgaFonts.h"
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Instance data for a VGA device this driver handles.
+ */
+typedef struct VBOXVGAMINIPORT
+{
+    /** The VGA Mini Port Protocol. */
+    EFI_VGA_MINI_PORT_PROTOCOL  VgaMiniPort;
+    /** Magic value, VBOX_VGA_MINI_PORT_MAGIC. */
+    UINT32                      u32Magic;
+    /** The controller handle of the device. */
+    EFI_HANDLE                  hController;
+    /** The PciIo protocol for the device. */
+    EFI_PCI_IO_PROTOCOL        *pPciIo;
+} VBOXVGAMINIPORT;
+/** Pointer to a VBOXVGAMINIPORT structure. */
+typedef VBOXVGAMINIPORT *PVBOXVGAMINIPORT;
+
+/** VBOXVGAMINIPORT::u32Magic value (Isaac Asimov). */
+#define VBOX_VGA_MINI_PORT_MAGIC        0x19200102
+/** VBOXVGAMINIPORT::u32Magic dead value. */
+#define VBOX_VGA_MINI_PORT_MAGIC_DEAD   0x19920406
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                            IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                        IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL);
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                       IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL);
+
+
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortVMP_SetMode(IN EFI_VGA_MINI_PORT_PROTOCOL *This, IN UINTN ModeNumber);
+
+
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
+                                IN CHAR8 *Language, OUT CHAR16 **DriverName);
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
+                                    IN EFI_HANDLE ControllerHandle,
+                                    IN EFI_HANDLE ChildHandle OPTIONAL,
+                                    IN CHAR8 *Language,  OUT CHAR16 **ControllerName);
+
+
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+                                 IN CHAR8 *Language, OUT CHAR16 **DriverName);
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+                                     IN EFI_HANDLE ControllerHandle,
+                                     IN EFI_HANDLE ChildHandle OPTIONAL,
+                                     IN CHAR8 *Language,  OUT CHAR16 **ControllerName);
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** EFI Driver Binding Protocol. */
+static EFI_DRIVER_BINDING_PROTOCOL          g_VBoxVgaMiniPortDB =
+{
+    VBoxVgaMiniPortDB_Supported,
+    VBoxVgaMiniPortDB_Start,
+    VBoxVgaMiniPortDB_Stop,
+    /* .Version             = */    1,  /* One higher than Pci/VgaMiniPortDxe. */
+    /* .ImageHandle         = */ NULL,
+    /* .DriverBindingHandle = */ NULL
+};
+
+/** EFI Component Name Protocol. */
+static const EFI_COMPONENT_NAME_PROTOCOL    g_VBoxVgaMiniPortCN =
+{
+    VBoxVgaMiniPortCN_GetDriverName,
+    VBoxVgaMiniPortCN_GetControllerName,
+    "eng"
+};
+
+/** EFI Component Name 2 Protocol. */
+static const EFI_COMPONENT_NAME2_PROTOCOL   g_VBoxVgaMiniPortCN2 =
+{
+    VBoxVgaMiniPortCN2_GetDriverName,
+    VBoxVgaMiniPortCN2_GetControllerName,
+    "en"
+};
+
+/** Driver name translation table. */
+static CONST EFI_UNICODE_STRING_TABLE       g_aVBoxMiniPortDriverLangAndNames[] =
+{
+    {   "eng;en",   L"PCI VGA Mini Port Driver" },
+    {   NULL,       NULL }
+};
+
+
+
+/**
+ * VBoxVgaMiniPort entry point.
+ *
+ * @returns EFI status code.
+ *
+ * @param   ImageHandle     The image handle.
+ * @param   SystemTable     The system table pointer.
+ */
+EFI_STATUS EFIAPI
+DxeInitializeVBoxVgaMiniPort(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
+{
+    EFI_STATUS  rc;
+    DEBUG((DEBUG_INFO, "DxeInitializeVBoxVgaMiniPort\n"));
+
+    rc = EfiLibInstallDriverBindingComponentName2(ImageHandle, SystemTable,
+                                                  &g_VBoxVgaMiniPortDB, ImageHandle,
+                                                  &g_VBoxVgaMiniPortCN, &g_VBoxVgaMiniPortCN2);
+    ASSERT_EFI_ERROR(rc);
+    return rc;
+}
+
+/**
+ * @copydoc EFI_DRIVER_BINDING_SUPPORTED
+ */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Supported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                            IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
+{
+    EFI_STATUS              rcRet = EFI_UNSUPPORTED;
+    EFI_PCI_IO_PROTOCOL    *pPciIo;
+    EFI_STATUS              rc;
+
+    DEBUG((DEBUG_INFO, "%a: Controller=%p\n", __FUNCTION__, ControllerHandle));
+
+    /*
+     * To perform the test we need to check some PCI configuration registers,
+     * just read all the standard ones to make life simpler.
+     */
+    rc = gBS->OpenProtocol(ControllerHandle, &gEfiPciIoProtocolGuid, (VOID **)&pPciIo,
+                           This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+    if (!EFI_ERROR(rc))
+    {
+        PCI_TYPE00  CfgRegs;
+
+        rc = pPciIo->Pci.Read(pPciIo,
+                              EfiPciIoWidthUint32,
+                              0 /* Offset */,
+                              sizeof(CfgRegs) / sizeof(UINT32) /* Count */ ,
+                              &CfgRegs);
+        if (!EFI_ERROR(rc))
+        {
+            /*
+             * Perform the test.
+             */
+            if (IS_PCI_VGA(&CfgRegs))
+            {
+#if 0 /** @todo this doesn't quite work with our DevVGA since it doesn't flag I/O access. */
+                if (    CfgRegs.Hdr.Command & (PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS)
+                    == (PCI_COMMAND_IOACCESS | PCI_COMMAND_MEMACCESS))
+#else
+                if (1)
+#endif
+                {
+                    DEBUG((DEBUG_INFO, "%a: Found supported VGA device! (VendorId=%x DeviceId=%x)\n",
+                           __FUNCTION__, CfgRegs.Hdr.VendorId, CfgRegs.Hdr.DeviceId));
+                    rcRet = EFI_SUCCESS;
+                }
+                else
+                    DEBUG((DEBUG_INFO, "%a: VGA device not enabled! (VendorId=%x DeviceId=%x)\n",
+                           __FUNCTION__, CfgRegs.Hdr.VendorId, CfgRegs.Hdr.DeviceId));
+            }
+            else
+                DEBUG((DEBUG_INFO, "%a: Not VGA (Class=%x,%x,%x VendorId=%x DeviceId=%x)\n",
+                       __FUNCTION__, CfgRegs.Hdr.ClassCode[0], CfgRegs.Hdr.ClassCode[1],
+                       CfgRegs.Hdr.ClassCode[2], CfgRegs.Hdr.VendorId, CfgRegs.Hdr.DeviceId));
+        }
+        else
+            DEBUG((DEBUG_INFO, "%a: pPciIo->Pci.Read -> %r\n", __FUNCTION__, rc));
+
+        gBS->CloseProtocol(ControllerHandle, &gEfiPciIoProtocolGuid, This->DriverBindingHandle, ControllerHandle);
+    }
+    else
+        DEBUG((DEBUG_INFO, "%a: PciIoProtocol -> %r\n", __FUNCTION__, rc));
+    return rcRet;
+}
+
+/**
+ * @copydoc EFI_DRIVER_BINDING_START
+ */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Start(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                        IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
+{
+    EFI_STATUS              rc;
+    EFI_PCI_IO_PROTOCOL    *pPciIo;
+
+    DEBUG((DEBUG_INFO, "%a\n", __FUNCTION__));
+
+    /*
+     * We need the PCI I/O abstraction protocol.
+     */
+    rc = gBS->OpenProtocol(ControllerHandle, &gEfiPciIoProtocolGuid, (VOID **)&pPciIo,
+                           This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+    if (!EFI_ERROR(rc))
+    {
+        /*
+         * Allocate and initialize the instance data.
+         */
+        PVBOXVGAMINIPORT pThisDev;
+        rc = gBS->AllocatePool(EfiBootServicesData, sizeof(*pThisDev), (VOID **)&pThisDev);
+        if (!EFI_ERROR(rc))
+        {
+            pThisDev->VgaMiniPort.SetMode                   = VBoxVgaMiniPortVMP_SetMode;
+            pThisDev->VgaMiniPort.VgaMemoryOffset           = 0x000b8000;
+            pThisDev->VgaMiniPort.CrtcAddressRegisterOffset = 0x03d4;
+            pThisDev->VgaMiniPort.CrtcDataRegisterOffset    = 0x03d5;
+            pThisDev->VgaMiniPort.VgaMemoryBar              = EFI_PCI_IO_PASS_THROUGH_BAR;
+            pThisDev->VgaMiniPort.CrtcAddressRegisterBar    = EFI_PCI_IO_PASS_THROUGH_BAR;
+            pThisDev->VgaMiniPort.CrtcDataRegisterBar       = EFI_PCI_IO_PASS_THROUGH_BAR;
+            pThisDev->VgaMiniPort.MaxMode                   = 2;
+            pThisDev->u32Magic                              = VBOX_VGA_MINI_PORT_MAGIC;
+            pThisDev->hController                           = ControllerHandle;
+            pThisDev->pPciIo                                = pPciIo;
+
+            /*
+             * Register the VGA Mini Port Protocol.
+             */
+            rc = gBS->InstallMultipleProtocolInterfaces(&ControllerHandle,
+                                                        &gEfiVgaMiniPortProtocolGuid, &pThisDev->VgaMiniPort,
+                                                        NULL, NULL);
+            if (!EFI_ERROR(rc))
+            {
+                DEBUG((DEBUG_INFO, "%a: Successfully started, pThisDev=%p ControllerHandle=%p\n",
+                       __FUNCTION__, pThisDev, ControllerHandle));
+                return EFI_SUCCESS;
+            }
+
+            DEBUG((DEBUG_INFO, "%a: InstallMultipleProtocolInterfaces -> %r\n", __FUNCTION__, rc));
+            gBS->FreePool(pThisDev);
+        }
+        else
+            DEBUG((DEBUG_INFO, "%a: AllocatePool -> %r\n", __FUNCTION__, rc));
+
+        gBS->CloseProtocol(ControllerHandle, &gEfiPciIoProtocolGuid, This->DriverBindingHandle, ControllerHandle);
+    }
+    else
+        DEBUG((DEBUG_INFO, "%a: PciIoProtocol -> %r\n", __FUNCTION__, rc));
+    return rc;
+}
+
+/**
+ * @copydoc EFI_DRIVER_BINDING_STOP
+ */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortDB_Stop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle,
+                       IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
+{
+    EFI_STATUS                  rc;
+    PVBOXVGAMINIPORT            pThisDev;
+
+    DEBUG((DEBUG_INFO, "%a: ControllerHandle=%p NumberOfChildren=%u\n", __FUNCTION__, ControllerHandle, NumberOfChildren));
+
+    /*
+     * Get the miniport driver instance associated with the controller.
+     */
+    rc = gBS->OpenProtocol(ControllerHandle, &gEfiVgaMiniPortProtocolGuid,
+                           (VOID **)&pThisDev, This->DriverBindingHandle,
+                           ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+    if (!EFI_ERROR(rc))
+    {
+        ASSERT(pThisDev->u32Magic == VBOX_VGA_MINI_PORT_MAGIC);
+        ASSERT(pThisDev->hController == ControllerHandle);
+        if (    pThisDev->u32Magic == VBOX_VGA_MINI_PORT_MAGIC
+            &&  pThisDev->hController == ControllerHandle)
+        {
+            /*
+             * Uninstall the VgaMiniPort interface.
+             */
+            rc = gBS->UninstallProtocolInterface(ControllerHandle,
+                                                 &gEfiVgaMiniPortProtocolGuid,
+                                                 &pThisDev->VgaMiniPort);
+            if (!EFI_ERROR(rc))
+            {
+                /*
+                 * Invalidate and release sources associated with the device instance.
+                 */
+                pThisDev->u32Magic = VBOX_VGA_MINI_PORT_MAGIC_DEAD;
+                gBS->FreePool(pThisDev);
+
+            }
+            else
+                DEBUG((DEBUG_INFO, "%a: UninstallProtocolInterface -> %r\n", __FUNCTION__, rc));
+        }
+        else
+        {
+            DEBUG((DEBUG_INFO, "%a: magic=%x/%x hController=%x/%x\n", __FUNCTION__,
+                   pThisDev->u32Magic, VBOX_VGA_MINI_PORT_MAGIC,
+                   pThisDev->hController, ControllerHandle));
+            rc = EFI_DEVICE_ERROR;
+        }
+        gBS->CloseProtocol(ControllerHandle, &gEfiPciIoProtocolGuid,
+                           This->DriverBindingHandle, ControllerHandle);
+    }
+    else
+        DEBUG((DEBUG_INFO, "%a: VgaMiniPortProtocol -> %r\n", __FUNCTION__, rc));
+    return rc;
+}
+
+
+
+
+
+/**
+ * @copydoc EFI_VGA_MINI_PORT_SET_MODE
+ */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortVMP_SetMode(IN EFI_VGA_MINI_PORT_PROTOCOL *This, IN UINTN ModeNumber)
+{
+    PVBOXVGAMINIPORT    pThisDev = (PVBOXVGAMINIPORT)This;
+    UINT8               r[64];
+    int                 i;
+
+    /*
+     * Check input.
+     */
+    if (pThisDev->u32Magic != VBOX_VGA_MINI_PORT_MAGIC)
+    {
+        DEBUG((DEBUG_INFO, "%a: u32Magic=%x/%x\n", __FUNCTION__, pThisDev->u32Magic, VBOX_VGA_MINI_PORT_MAGIC));
+        return EFI_DEVICE_ERROR;
+    }
+    if (ModeNumber >= This->MaxMode)
+    {
+        DEBUG((DEBUG_INFO, "%a: ModeNumber=%d >= MaxMode=%d\n", __FUNCTION__, ModeNumber, This->MaxMode));
+        return EFI_UNSUPPORTED;
+    }
+    DEBUG((DEBUG_INFO, "%a: ModeNumber=%d\n", __FUNCTION__, ModeNumber));
+
+    /* some initialization */
+    ASMOutU8(0x3c2, 0xc3);
+    ASMOutU8(0x3c4, 0x04);
+    ASMOutU8(0x3c5, 0x02);
+
+    /*
+     * inb(r63, 0x3da);                     // reset attr F/F
+     * outb(0x3c0, 0);                      // disable palette
+     * outb(0x3d4, 0x11); outb(0x3d5, 0);   // unprotect crtc regs 0 - 7
+     */
+    r[63] = ASMInU8((UINTN)0x3da);
+    ASMOutU8(0x3c0, 0);
+    ASMOutU16(0x3d4, 0x0011);
+
+#define BOUTB(count, aport, dport)  \
+     do {                                \
+         for (i = 0 ; i < count; ++i)    \
+         {                               \
+             ASMOutU8((aport), (UINT8)i);\
+             ASMOutU8((dport), r[i]);    \
+         }                               \
+     } while (0)
+
+    /*
+     *  Reset and set sequencer registers
+     *
+     * r0 = 0x01;  r1 = 0x00;  r2 = 0x03;  r3 = 0x00;  r4 = 0x02;
+     * boutb(5, 0x3c4, 0x3c5);
+     */
+     r[0] = 0x01;
+     r[1] = 0x00;
+     r[2] = 0x03;
+     r[3] = 0x00;
+     r[4] = 0x02;
+     BOUTB(5, 0x3c4, 0x3c5);
+
+     /*
+      *  set misc out register
+      *
+      * outb(0x3c2, 0x67);
+      *
+      * r0 = 3
+      * boutb(1, 0x3c4, 0x3c5);         // enable sequencer
+      */
+     r[0] = 3;
+     BOUTB(1, 0x3c4, 0x3c5);
+
+     /*  set all crtc registers */
+     r[0] = 0x5f;  r[1] = 0x4f;  r[2] = 0x50;  r[3] = 0x82;
+     r[4] = 0x55;  r[5] = 0x81;  r[6] = 0xbf;  r[7] = 0x1f;
+     r[8] = 0x00;  r[9] = 0x4f;  r[10]= 0x0d;  r[11]= 0x0e;
+     r[12]= 0x00;  r[13]= 0x00;  r[14]= 0x03;  r[15]= 0xc0;
+     r[16]= 0x9c;  r[17]= 0x0e;  r[18]= 0x8f;  r[19]= 0x28;
+     r[20]= 0x1f;  r[21]= 0x96;  r[22]= 0xb9;  r[23]= 0xa3;
+     r[24]= 0xff;
+     BOUTB(25, 0x3d4, 0x3d5);
+
+     /*  set all graphics controller registers */
+     r[0]= 0x00;  r[1]= 0x00;  r[2]= 0x00;  r[3]= 0x00;
+     r[4]= 0x00;  r[5]= 0x10;  r[6]= 0x0e;  r[7]= 0x00;
+     r[8]= 0xff;
+     BOUTB(9, 0x3ce, 0x3cf);
+
+     /*  set all attribute registers */
+     r[63] = ASMInU8(0x3da);            // reset flip/flop
+     r[0] = 0x00;  r[1] = 0x01;  r[2] = 0x02;  r[3] = 0x03;
+     r[4] = 0x04;  r[5] = 0x05;  r[6] = 0x14;  r[7] = 0x07;
+     r[8] = 0x38;  r[9] = 0x39;  r[10]= 0x3a;  r[11]= 0x3b;
+     r[12]= 0x3c;  r[13]= 0x3d;  r[14]= 0x3e;  r[15]= 0x3f;
+     r[16]= 0x0c;  r[17]= 0x00;  r[18]= 0x0f;  r[19]= 0x08;
+     r[20]= 0x00;
+     BOUTB(21, 0x3c0, 0x3c0);
+     ASMOutU8(0x3c0, 0x20);             // re-enable palette
+
+     /* set all VBox extended registers */
+     r[0] = 1;
+     BOUTB(1, 0x3c4, 0x3c5);            // disable sequencer
+
+     ASMOutU16(0x1ce, 0x04); ASMOutU16(0x1cf, 0);  // ENABLE
+
+     r[0] = 3;
+     BOUTB(1, 0x3c4, 0x3c5);            // enable sequencer
+
+     /* Load default values into the first 16 entries of the DAC */
+     {
+         static const UINT8 s_a3bVgaDac[64*3] =
+         {
+             0x00, 0x00, 0x00,
+             0x00, 0x00, 0x2A,
+             0x00, 0x2A, 0x00,
+             0x00, 0x2A, 0x2A,
+             0x2A, 0x00, 0x00,
+             0x2A, 0x00, 0x2A,
+             0x2A, 0x2A, 0x00,
+             0x2A, 0x2A, 0x2A,
+             0x00, 0x00, 0x15,
+             0x00, 0x00, 0x3F,
+             0x00, 0x2A, 0x15,
+             0x00, 0x2A, 0x3F,
+             0x2A, 0x00, 0x15,
+             0x2A, 0x00, 0x3F,
+             0x2A, 0x2A, 0x15,
+             0x2A, 0x2A, 0x3F,
+             0x00, 0x15, 0x00,
+             0x00, 0x15, 0x2A,
+             0x00, 0x3F, 0x00,
+             0x00, 0x3F, 0x2A,
+             0x2A, 0x15, 0x00,
+             0x2A, 0x15, 0x2A,
+             0x2A, 0x3F, 0x00,
+             0x2A, 0x3F, 0x2A,
+             0x00, 0x15, 0x15,
+             0x00, 0x15, 0x3F,
+             0x00, 0x3F, 0x15,
+             0x00, 0x3F, 0x3F,
+             0x2A, 0x15, 0x15,
+             0x2A, 0x15, 0x3F,
+             0x2A, 0x3F, 0x15,
+             0x2A, 0x3F, 0x3F,
+             0x15, 0x00, 0x00,
+             0x15, 0x00, 0x2A,
+             0x15, 0x2A, 0x00,
+             0x15, 0x2A, 0x2A,
+             0x3F, 0x00, 0x00,
+             0x3F, 0x00, 0x2A,
+             0x3F, 0x2A, 0x00,
+             0x3F, 0x2A, 0x2A,
+             0x15, 0x00, 0x15,
+             0x15, 0x00, 0x3F,
+             0x15, 0x2A, 0x15,
+             0x15, 0x2A, 0x3F,
+             0x3F, 0x00, 0x15,
+             0x3F, 0x00, 0x3F,
+             0x3F, 0x2A, 0x15,
+             0x3F, 0x2A, 0x3F,
+             0x15, 0x15, 0x00,
+             0x15, 0x15, 0x2A,
+             0x15, 0x3F, 0x00,
+             0x15, 0x3F, 0x2A,
+             0x3F, 0x15, 0x00,
+             0x3F, 0x15, 0x2A,
+             0x3F, 0x3F, 0x00,
+             0x3F, 0x3F, 0x2A,
+             0x15, 0x15, 0x15,
+             0x15, 0x15, 0x3F,
+             0x15, 0x3F, 0x15,
+             0x15, 0x3F, 0x3F,
+             0x3F, 0x15, 0x15,
+             0x3F, 0x15, 0x3F,
+             0x3F, 0x3F, 0x15,
+             0x3F, 0x3F, 0x3F
+          };
+
+          for (i = 0; i < 64; ++i)
+          {
+              ASMOutU8(0x3c8, (UINT8)i);
+              ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 0]);
+              ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 1]);
+              ASMOutU8(0x3c9, s_a3bVgaDac[i*3 + 2]);
+          }
+     }
+
+     /* Load the appropriate font into the first map */
+     {
+        UINT8 const    *pabFont;
+        unsigned        offBase = 0;
+        UINT16          height;
+
+        switch (ModeNumber) {
+        case 0: // 80x25 mode, uses 8x16 font
+            pabFont = g_abVgaFont_8x16;
+            height  = 16;
+            break;
+        case 1: // 80x50 mode, uses 8x8 font
+            pabFont = g_abVgaFont_8x8;
+            height  = 8;
+            break;
+        default:
+            ASSERT(0);  // Valid mode numbers checked above
+            return EFI_UNSUPPORTED;
+        }
+        // Enable font map access
+        {
+            /* Write sequencer registers */
+            ASMOutU16(0x3c4, 0x0100);
+            ASMOutU16(0x3c4, 0x0402);
+            ASMOutU16(0x3c4, 0x0704);
+            ASMOutU16(0x3c4, 0x0300);
+            /* Write graphics controller registers */
+            ASMOutU16(0x3ce, 0x0204);
+            ASMOutU16(0x3ce, 0x0005);
+            ASMOutU16(0x3ce, 0x0406);
+        }
+
+        for (i = 0; i < 256; ++i)
+        {
+            int offChr = i * height;
+            int offDst = offBase + i * 32;
+            CopyMem((UINT8 *)0xA0000 + offDst, pabFont + offChr, height);
+        }
+
+        // Set the CRTC Maximum Scan Line register
+        ASMOutU16(0x3d4, 0x4009 | ((height - 1) << 8));
+
+        // Disable font map access again
+        {
+            /* Write sequencer registers */
+            ASMOutU16(0x3c4, 0x0100);
+            ASMOutU16(0x3c4, 0x0302);
+            ASMOutU16(0x3c4, 0x0304);
+            ASMOutU16(0x3c4, 0x0300);
+            /* Write graphics controller registers */
+            ASMOutU16(0x3ce, 0x0004);
+            ASMOutU16(0x3ce, 0x1005);
+            ASMOutU16(0x3ce, 0x0e06);
+        }
+    }
+
+    return EFI_SUCCESS;
+}
+
+
+
+
+/** @copydoc EFI_COMPONENT_NAME_GET_DRIVER_NAME */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN_GetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
+                                IN CHAR8 *Language, OUT CHAR16 **DriverName)
+{
+    return LookupUnicodeString2(Language,
+                                This->SupportedLanguages,
+                                &g_aVBoxMiniPortDriverLangAndNames[0],
+                                DriverName,
+                                TRUE);
+}
+
+/** @copydoc EFI_COMPONENT_NAME_GET_CONTROLLER_NAME */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN_GetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This,
+                                    IN EFI_HANDLE ControllerHandle,
+                                    IN EFI_HANDLE ChildHandle OPTIONAL,
+                                    IN CHAR8 *Language, OUT CHAR16 **ControllerName)
+{
+    /** @todo try query the protocol from the controller and forward the query. */
+    return EFI_UNSUPPORTED;
+}
+
+
+
+
+/** @copydoc EFI_COMPONENT_NAME2_GET_DRIVER_NAME */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN2_GetDriverName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+                                 IN CHAR8 *Language, OUT CHAR16 **DriverName)
+{
+    return LookupUnicodeString2(Language,
+                                This->SupportedLanguages,
+                                &g_aVBoxMiniPortDriverLangAndNames[0],
+                                DriverName,
+                                FALSE);
+}
+
+/** @copydoc EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME */
+static EFI_STATUS EFIAPI
+VBoxVgaMiniPortCN2_GetControllerName(IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+                                     IN EFI_HANDLE ControllerHandle,
+                                     IN EFI_HANDLE ChildHandle OPTIONAL,
+                                     IN CHAR8 *Language, OUT CHAR16 **ControllerName)
+{
+    /** @todo try query the protocol from the controller and forward the query. */
+    return EFI_UNSUPPORTED;
+}
+
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf	(revision 26438)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVgaMiniPortDxe/VBoxVgaMiniPortDxe.inf	(revision 26438)
@@ -0,0 +1,64 @@
+# $Id$
+## @file
+# VBoxVgaMiniPortDxe.inf - VgaMiniPort Protocol module declaration.
+#
+
+
+#
+# Copyright (C) 2009,2010 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#/
+
+
+
+[Defines]
+        INF_VERSION                = 0x00010005
+        BASE_NAME                  = VBoxVgaMiniPortDxe
+        FILE_GUID                  = AE8558FD-9DA9-4FA1-AE16-94456C977244
+        MODULE_TYPE                = UEFI_DRIVER
+        VERSION_STRING             = 1.0
+        EDK_RELEASE_VERSION        = 0x00020000
+        EFI_SPECIFICATION_VERSION  = 0x00020000
+        ENTRY_POINT                = DxeInitializeVBoxVgaMiniPort
+
+[Sources.common]
+        VBoxVgaMiniPortDxe.c
+        VBoxVgaFonts.h
+        VBoxVgaFont-8x14.h
+
+[Packages]
+        MdePkg/MdePkg.dec
+        IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+        VBoxPkg/VBoxPkg.dec
+
+[LibraryClasses]
+   UefiLib
+   DebugLib
+   UefiBootServicesTableLib
+   UefiDriverEntryPoint
+   BaseMemoryLib
+   MemoryAllocationLib
+
+[Protocols]
+        gEfiPciIoProtocolGuid               ## TO_START
+        gEfiVgaMiniPortProtocolGuid         ## BY_START
