diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-21 14:39:56 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-01-21 14:39:56 +0000 |
commit | 93e3992d1ea50fb30c48f498d257d4e66252dd9b (patch) | |
tree | b76adcd31d2017cd76317f21be967ad3cb05305e /MdeModulePkg/Universal/Console | |
parent | f79314fa8f44a79e862d2877e5a9b1a3a9f96791 (diff) | |
download | edk2-93e3992d1ea50fb30c48f498d257d4e66252dd9b.tar.gz edk2-93e3992d1ea50fb30c48f498d257d4e66252dd9b.tar.bz2 edk2-93e3992d1ea50fb30c48f498d257d4e66252dd9b.zip |
UEFI HII: Merge UEFI HII support changes from branch.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4599 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console')
4 files changed, 178 insertions, 40 deletions
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index 37e816af01..77a209e1e4 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -83,10 +83,19 @@ GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = { { 0, 0, 0, 0, 0, 0 } // Mode 3
},
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
- (EFI_HII_HANDLE) 0
+ (EFI_HII_HANDLE ) 0
};
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
+EFI_HII_FONT_PROTOCOL *mHiiFont;
+BOOLEAN mFirstAccessFlag = TRUE;
+
+STATIC EFI_GUID mFontPackageListGuid = {0xf5f219d3, 0x7006, 0x4648, 0xac, 0x8d, 0xd6, 0x1d, 0xfb, 0x7b, 0xc6, 0xad};
+
+#else
EFI_HII_PROTOCOL *mHii;
+#endif
static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
@@ -194,6 +203,7 @@ GraphicsConsoleControllerDriverSupported ( } else {
goto Error;
}
+
//
// Does Hii Exist? If not, we aren't ready to run
//
@@ -249,8 +259,6 @@ GraphicsConsoleControllerDriverStart ( {
EFI_STATUS Status;
GRAPHICS_CONSOLE_DEV *Private;
- EFI_HII_PACKAGES *Package;
- EFI_HII_FONT_PACK *FontPack;
UINTN NarrowFontSize;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
@@ -259,9 +267,8 @@ GraphicsConsoleControllerDriverStart ( UINTN MaxMode;
UINTN Columns;
UINTN Rows;
- UINT8 *Location;
UINT32 ModeNumber;
-
+
ModeNumber = 0;
//
@@ -301,17 +308,14 @@ GraphicsConsoleControllerDriverStart ( }
}
- //
- // Get the HII protocol. If Supported() succeeds, do we really
- // need to get HII protocol again?
- //
- Status = EfiLocateHiiProtocol ();
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
NarrowFontSize = ReturnNarrowFontSize ();
+#if 1
+ if (mFirstAccessFlag) {
+ HiiLibAddFontPackageToHiiDatabase (NarrowFontSize, (UINT8 *) UsStdNarrowGlyphData, &mFontPackageListGuid, &(Private->HiiHandle));
+ mFirstAccessFlag = FALSE;
+ }
+#else
FontPack = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
ASSERT (FontPack);
@@ -333,7 +337,7 @@ GraphicsConsoleControllerDriverStart ( // Free the font database
//
FreePool (FontPack);
-
+#endif
//
// If the current mode information can not be retrieved, then attemp to set the default mode
// of 800x600, 32 bit colot, 60 Hz refresh.
@@ -614,7 +618,14 @@ GraphicsConsoleControllerDriverStop ( //
// Remove the font pack
//
+#if 1
+ Status = HiiLibRemovePackagesFromHiiDatabase (Private->HiiHandle);
+ if (!EFI_ERROR (Status)) {
+ mFirstAccessFlag = TRUE;
+ }
+#else
mHii->RemovePack (mHii, Private->HiiHandle);
+#endif
//
// Free our instance data
@@ -678,7 +689,7 @@ EfiLocateHiiProtocol ( /*++
Routine Description:
- Find if the HII protocol is available. If yes, locate the HII protocol
+ Locate HII protocols for future usage.
Arguments:
@@ -690,6 +701,43 @@ EfiLocateHiiProtocol ( UINTN Size;
EFI_STATUS Status;
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+
+ //
+ // There should only be one - so buffer size is this
+ //
+ Size = sizeof (EFI_HANDLE);
+
+ Status = gBS->LocateHandle (
+ ByProtocol,
+ &gEfiHiiDatabaseProtocolGuid,
+ NULL,
+ &Size,
+ (VOID **) &Handle
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiHiiDatabaseProtocolGuid,
+ (VOID **) &mHiiDatabase
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = gBS->HandleProtocol (
+ Handle,
+ &gEfiHiiFontProtocolGuid,
+ (VOID **) &mHiiFont
+ );
+ return Status;
+#else
+
//
// There should only be one - so buffer size is this
//
@@ -710,11 +758,13 @@ EfiLocateHiiProtocol ( Status = gBS->HandleProtocol (
Handle,
&gEfiHiiProtocolGuid,
- (VOID **)&mHii
+ &mHii
);
return Status;
+#endif
}
+
//
// Body of the STO functions
//
@@ -1090,15 +1140,31 @@ GraphicsConsoleConOutTestString ( --*/
{
EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
UINT16 Count;
- GLYPH_UNION *Glyph;
-
- GlyphStatus = 0;
- Count = 0;
- while (WString[Count]) {
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ EFI_IMAGE_OUTPUT *Blt = NULL;
+#else
+ UINT16 GlyphWidth;
+ UINT32 GlyphStatus = 0;
+ GLYPH_UNION *Glyph;
+#endif
+
+ Count = 0;
+
+ while (WString[Count] != 0) {
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+ Status = mHiiFont->GetGlyph (
+ mHiiFont,
+ WString[Count],
+ NULL,
+ &Blt,
+ NULL
+ );
+ SafeFreePool (Blt);
+ Blt = NULL;
+ Count++;
+#else
Status = mHii->GetGlyph (
mHii,
WString,
@@ -1107,7 +1173,7 @@ GraphicsConsoleConOutTestString ( &GlyphWidth,
&GlyphStatus
);
-
+#endif
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
@@ -1654,6 +1720,69 @@ GetTextColors ( return EFI_SUCCESS;
}
+#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
+EFI_STATUS
+DrawUnicodeWeightAtCursorN (
+ IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
+ IN CHAR16 *UnicodeWeight,
+ IN UINTN Count
+ )
+{
+ EFI_STATUS Status;
+ GRAPHICS_CONSOLE_DEV *Private;
+ EFI_IMAGE_OUTPUT *Blt;
+ EFI_STRING String;
+ EFI_FONT_DISPLAY_INFO *FontInfo;
+
+ Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
+ //
+ // GOP protocol is required in UEFI mode.
+ //
+ ASSERT (Private->GraphicsOutput != NULL);
+
+ Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
+ if (Blt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ Blt->Width = (UINT16) (Private->ModeData[This->Mode->Mode].GopWidth);
+ Blt->Height = (UINT16) (Private->ModeData[This->Mode->Mode].GopHeight);
+ Blt->Image.Screen = Private->GraphicsOutput;
+
+ String = AllocateCopyPool ((Count + 1) * sizeof (CHAR16), UnicodeWeight);
+ if (String == NULL) {
+ SafeFreePool (Blt);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ *(String + Count) = 0;
+
+ FontInfo = (EFI_FONT_DISPLAY_INFO *) AllocateZeroPool (sizeof (EFI_FONT_DISPLAY_INFO));
+ if (FontInfo == NULL) {
+ SafeFreePool (Blt);
+ SafeFreePool (String);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ GetTextColors (This, &FontInfo->ForegroundColor, &FontInfo->BackgroundColor);
+
+ Status = mHiiFont->StringToImage (
+ mHiiFont,
+ EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_DIRECT_TO_SCREEN,
+ String,
+ FontInfo,
+ &Blt,
+ This->Mode->CursorColumn * GLYPH_WIDTH + Private->ModeData[This->Mode->Mode].DeltaX,
+ This->Mode->CursorRow * GLYPH_HEIGHT + Private->ModeData[This->Mode->Mode].DeltaY,
+ NULL,
+ NULL,
+ NULL
+ );
+
+ SafeFreePool (Blt);
+ SafeFreePool (String);
+ SafeFreePool (FontInfo);
+ return Status;
+}
+#else
STATIC
EFI_STATUS
DrawUnicodeWeightAtCursorN (
@@ -1794,6 +1923,7 @@ DrawUnicodeWeightAtCursorN ( return ReturnStatus;
}
+#endif
STATIC
EFI_STATUS
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h index f78c22c564..1c182f3b90 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h @@ -24,7 +24,7 @@ Revision History #define _GRAPHICS_CONSOLE_H
#include <PiDxe.h>
-#include <Protocol/FrameworkHii.h>
+//#include <Protocol/FrameworkHii.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/UgaDraw.h>
@@ -32,10 +32,17 @@ Revision History #include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
-#include <Library/FrameworkHiiLib.h>
+//#include <Library/FrameworkHiiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/HiiLib.h>
+#include <Library/BaseLib.h>
+
+#include <MdeModuleHii.h>
+
+#include <Protocol/HiiFont.h>
+#include <Protocol/HiiDatabase.h>
extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
@@ -174,8 +181,8 @@ GraphicsConsoleComponentNameGetControllerName ( //
// Glyph database
//
-#define GLYPH_WIDTH 8
-#define GLYPH_HEIGHT 19
+//#define GLYPH_WIDTH 8
+//#define GLYPH_HEIGHT 19
//
// User can define valid graphic resolution here
@@ -307,11 +314,6 @@ GraphicsConsoleConOutEnableCursor ( );
EFI_STATUS
-EfiLocateHiiProtocol (
- VOID
- );
-
-EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
@@ -336,4 +338,11 @@ GraphicsConsoleControllerDriverStop ( IN EFI_HANDLE *ChildHandleBuffer
);
+EFI_STATUS
+EfiLocateHiiProtocol (
+ VOID
+ )
+;
+
+
#endif
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf index 013bc18389..4ccfe2177c 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf @@ -21,7 +21,7 @@ MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
- EFI_SPECIFICATION_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x0002000A
ENTRY_POINT = InitializeGraphicsConsole
@@ -43,6 +43,7 @@ [Packages]
MdePkg/MdePkg.dec
# currently use Hii for glyph lookup, need to change to UEFI scheme
+ MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
@@ -52,12 +53,13 @@ UefiLib
UefiDriverEntryPoint
DebugLib
- FrameworkHiiLib
+ HiiLib
[Protocols]
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSimpleTextOutProtocolGuid # PROTOCOL BY_START
- gEfiHiiProtocolGuid # PROTOCOL TO_START
gEfiGraphicsOutputProtocolGuid # PROTOCOL TO_START
gEfiUgaDrawProtocolGuid # PROTOCOL TO_START
+ gEfiHiiFontProtocolGuid
+ gEfiHiiDatabaseProtocolGuid
diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.msa b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.msa index 187cc9b4ec..4276a2d042 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.msa +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.msa @@ -65,9 +65,6 @@ <Protocol Usage="TO_START">
<ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
</Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
<Protocol Usage="BY_START">
<ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
</Protocol>
|