[BOOTMGFW]

- Last round of display fixes. GOP works now -- fill out the frame buffer with gray as a test (tested in VirtualBox).
- Now to fix the heap.

svn path=/trunk/; revision=69097
This commit is contained in:
Alex Ionescu 2015-09-07 18:45:09 +00:00
parent 0f004c15de
commit 0d9800b14e
3 changed files with 100 additions and 22 deletions

View file

@ -770,18 +770,46 @@ MmMdFreeGlobalDescriptors (
VOID VOID
) )
{ {
PBL_MEMORY_DESCRIPTOR Descriptor, OldDescriptor;
ULONG Index = 0; ULONG Index = 0;
PLIST_ENTRY OldFlink, OldBlink;
/* Make sure we're not int middle of a call using a descriptor */ /* Make sure we're not int middle of a call using a descriptor */
EarlyPrint(L"Call depth is %d\n", MmDescriptorCallTreeCount);
if (MmDescriptorCallTreeCount != 1) if (MmDescriptorCallTreeCount != 1)
{ {
return; return;
} }
/* Loop every current global descriptor */ /* Loop every current global descriptor */
EarlyPrint(L"MmGlobalMemoryDescriptorsUsed: %d\n", MmGlobalMemoryDescriptorsUsed);
while (Index < MmGlobalMemoryDescriptorsUsed) while (Index < MmGlobalMemoryDescriptorsUsed)
{ {
EarlyPrint(L"Global descriptors not yet supported\n"); /* Does it have any valid pageS? */
OldDescriptor = &MmGlobalMemoryDescriptors[Index];
if (OldDescriptor->PageCount)
{
/* Allocate a copy of it */
Descriptor = BlMmAllocateHeap(sizeof(*Descriptor));
if (!Descriptor)
{
return;
}
/* Save the links */
OldFlink = OldDescriptor->ListEntry.Blink;
OldBlink = OldDescriptor->ListEntry.Flink;
/* Make the copy */
*Descriptor = *OldDescriptor;
/* Fix the links */
OldBlink->Flink = &Descriptor->ListEntry;
OldFlink->Blink = &Descriptor->ListEntry;
/* Zero the descriptor */
RtlZeroMemory(OldDescriptor, sizeof(*OldDescriptor));
}
/* Keep going */ /* Keep going */
Index++; Index++;

View file

@ -304,7 +304,7 @@ BlpMmInitialize (
/* Go back to static descriptors and kill the heap */ /* Go back to static descriptors and kill the heap */
//MmMdpSwitchToStaticDescriptors(); //MmMdpSwitchToStaticDescriptors();
//HapInitializationStatus = 0; //HapInitializationStatus = 0;
++MmDescriptorCallTreeCount; //++MmDescriptorCallTreeCount;
/* Destroy the Phase 1 initialization */ /* Destroy the Phase 1 initialization */
//MmPaDestroy(0); //MmPaDestroy(0);
@ -315,7 +315,7 @@ BlpMmInitialize (
Quickie: Quickie:
/* Free the memory descriptors and return the initialization state */ /* Free the memory descriptors and return the initialization state */
//MmMdFreeGlobalDescriptors(); MmMdFreeGlobalDescriptors();
--MmDescriptorCallTreeCount; --MmDescriptorCallTreeCount;
return Status; return Status;
} }

View file

@ -146,17 +146,12 @@ typedef enum _BL_GRAPHICS_CONSOLE_TYPE
typedef struct _BL_GRAPHICS_CONSOLE typedef struct _BL_GRAPHICS_CONSOLE
{ {
BL_TEXT_CONSOLE TextConsole; BL_TEXT_CONSOLE TextConsole;
BL_DISPLAY_MODE DisplayMode; BL_DISPLAY_MODE DisplayMode;
ULONG PixelDepth; ULONG PixelDepth;
ULONG FgColor; ULONG FgColor;
ULONG BgColor; ULONG BgColor;
BL_DISPLAY_MODE OldDisplayMode; BL_DISPLAY_MODE OldDisplayMode;
ULONG OldPixelDepth; ULONG OldPixelDepth;
EFI_HANDLE Handle; EFI_HANDLE Handle;
BL_GRAPHICS_CONSOLE_TYPE Type; BL_GRAPHICS_CONSOLE_TYPE Type;
EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol; EFI_GRAPHICS_OUTPUT_PROTOCOL* Protocol;
@ -167,6 +162,11 @@ typedef struct _BL_GRAPHICS_CONSOLE
ULONG OldMode; ULONG OldMode;
} BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE; } BL_GRAPHICS_CONSOLE, *PBL_GRAPHICS_CONSOLE;
typedef struct _BL_REMOTE_CONSOLE
{
BL_TEXT_CONSOLE TextConsole;
} BL_REMOTE_CONSOLE, *PBL_REMOTE_CONSOLE;
PVOID BfiCachedStrikeData; PVOID BfiCachedStrikeData;
LIST_ENTRY BfiDeferredListHead; LIST_ENTRY BfiDeferredListHead;
LIST_ENTRY BfiFontFileListHead; LIST_ENTRY BfiFontFileListHead;
@ -1342,6 +1342,49 @@ ConsoleGraphicalConstruct (
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS
ConsoleRemoteConstruct (
_In_ PBL_REMOTE_CONSOLE RemoteConsole
)
{
#ifdef BL_EMS_SUPPORT
#error Implement me
#else
/* We don't support EMS for now */
return STATUS_NOT_IMPLEMENTED;
#endif
}
NTSTATUS
ConsoleCreateRemoteConsole (
_In_ PBL_TEXT_CONSOLE* TextConsole
)
{
PBL_REMOTE_CONSOLE RemoteConsole;
NTSTATUS Status;
/* Allocate the remote console */
RemoteConsole = BlMmAllocateHeap(sizeof(*RemoteConsole));
if (!RemoteConsole)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Construct it */
Status = ConsoleRemoteConstruct(RemoteConsole);
if (Status < 0)
{
/* Failed to construct it, delete it */
BlMmFreeHeap(RemoteConsole);
return Status;
}
/* Save the global pointer and return a pointer to the text console */
DspRemoteInputConsole = RemoteConsole;
*TextConsole = &RemoteConsole->TextConsole;
return STATUS_SUCCESS;
}
NTSTATUS NTSTATUS
DsppInitialize ( DsppInitialize (
_In_ ULONG Flags _In_ ULONG Flags
@ -1353,8 +1396,7 @@ DsppInitialize (
PBL_DISPLAY_MODE DisplayMode; PBL_DISPLAY_MODE DisplayMode;
//ULONG GraphicsResolution; //ULONG GraphicsResolution;
PBL_GRAPHICS_CONSOLE GraphicsConsole; PBL_GRAPHICS_CONSOLE GraphicsConsole;
// PVOID RemoteConsole; PBL_TEXT_CONSOLE TextConsole, RemoteConsole;
PBL_TEXT_CONSOLE TextConsole;
/* Initialize font data */ /* Initialize font data */
BfiCachedStrikeData = 0; BfiCachedStrikeData = 0;
@ -1362,11 +1404,11 @@ DsppInitialize (
InitializeListHead(&BfiFontFileListHead); InitializeListHead(&BfiFontFileListHead);
/* Allocate the font rectangle */ /* Allocate the font rectangle */
// BfiGraphicsRectangle = BlMmAllocateHeap(0x5A); BfiGraphicsRectangle = BlMmAllocateHeap(0x5A);
//if (!BfiGraphicsRectangle) if (!BfiGraphicsRectangle)
//{ {
//return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
//} }
/* Display re-initialization not yet handled */ /* Display re-initialization not yet handled */
if (LibraryParameters.LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL) if (LibraryParameters.LibraryFlags & BL_LIBRARY_FLAG_REINITIALIZE_ALL)
@ -1406,6 +1448,7 @@ DsppInitialize (
#endif #endif
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG;
EarlyPrint(L"Display selection not yet handled\n"); EarlyPrint(L"Display selection not yet handled\n");
return STATUS_NOT_IMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
} }
@ -1421,7 +1464,9 @@ DsppInitialize (
#endif #endif
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
ConsoleGraphicalResolutionListFlags |= 2; ConsoleGraphicalResolutionListFlags |= BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG;
EarlyPrint(L"High res mode not yet handled\n");
return STATUS_NOT_IMPLEMENTED;
} }
/* Do we need graphics mode after all? */ /* Do we need graphics mode after all? */
@ -1433,12 +1478,17 @@ DsppInitialize (
{ {
/* Construct it */ /* Construct it */
Status = ConsoleGraphicalConstruct(GraphicsConsole); Status = ConsoleGraphicalConstruct(GraphicsConsole);
EarlyPrint(L"GFX FAILED: %lx\n", Status);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
EarlyPrint(L"GFX FAILED: %lx\n", Status);
BlMmFreeHeap(GraphicsConsole); BlMmFreeHeap(GraphicsConsole);
GraphicsConsole = NULL; GraphicsConsole = NULL;
} }
else
{
/* TEST */
RtlFillMemory(GraphicsConsole->FrameBuffer, GraphicsConsole->FrameBufferSize, 0x55);
}
} }
} }
@ -1450,7 +1500,8 @@ DsppInitialize (
} }
/* Mask out all the flags now */ /* Mask out all the flags now */
ConsoleGraphicalResolutionListFlags &= ~3; ConsoleGraphicalResolutionListFlags &= ~(BL_DISPLAY_GRAPHICS_FORCED_VIDEO_MODE_FLAG |
BL_DISPLAY_GRAPHICS_FORCED_HIGH_RES_MODE_FLAG);
} }
/* Do we have a graphics console? */ /* Do we have a graphics console? */
@ -1477,15 +1528,14 @@ DsppInitialize (
DspGraphicalConsole = NULL; DspGraphicalConsole = NULL;
/* If we don't have a text console, go get a remote console */ /* If we don't have a text console, go get a remote console */
//RemoteConsole = NULL; RemoteConsole = NULL;
if (!TextConsole) if (!TextConsole)
{ {
EarlyPrint(L"Display path not handled\n"); ConsoleCreateRemoteConsole(&RemoteConsole);
return STATUS_NOT_SUPPORTED;
} }
/* Do we have a remote console? */ /* Do we have a remote console? */
if (!DspRemoteInputConsole) if (!RemoteConsole)
{ {
/* Nope -- what about a graphical one? */ /* Nope -- what about a graphical one? */
if (GraphicsConsole) if (GraphicsConsole)