mirror of https://github.com/acidanthera/audk.git
Add a lock to protect the critical region in Service APIs for gEfiSimpleTextOutProtocolGuid Protocol to prevent re-entrance of the same API from from different TPL level. In UEFI 2.1 spec, it is state that the service API for this Protocol is callable at EFI_TPL_NOTIFY level.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2447 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a2fa23fee1
commit
0fe0b10e10
|
@ -6,7 +6,7 @@ Remaining Tasks
|
||||||
Solve palette issues for mixed graphics and text
|
Solve palette issues for mixed graphics and text
|
||||||
When does this protocol reset the palette?
|
When does this protocol reset the palette?
|
||||||
|
|
||||||
Copyright (c) 2006 Intel Corporation. <BR>
|
Copyright (c) 2006 - 2007 Intel Corporation. <BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -720,8 +720,12 @@ GraphicsConsoleConOutOutputString (
|
||||||
UINTN Count;
|
UINTN Count;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
INT32 OriginAttribute;
|
INT32 OriginAttribute;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
|
CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
//
|
//
|
||||||
// Current mode
|
// Current mode
|
||||||
//
|
//
|
||||||
|
@ -959,10 +963,12 @@ GraphicsConsoleConOutOutputString (
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
if (Warning) {
|
if (Warning) {
|
||||||
return EFI_WARN_UNKNOWN_GLYPH;
|
Status = EFI_WARN_UNKNOWN_GLYPH;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1063,22 +1069,30 @@ GraphicsConsoleConOutQueryMode (
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
GRAPHICS_CONSOLE_DEV *Private;
|
GRAPHICS_CONSOLE_DEV *Private;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
|
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
||||||
|
|
||||||
*Columns = Private->ModeData[ModeNumber].Columns;
|
*Columns = Private->ModeData[ModeNumber].Columns;
|
||||||
*Rows = Private->ModeData[ModeNumber].Rows;
|
*Rows = Private->ModeData[ModeNumber].Rows;
|
||||||
|
|
||||||
if (*Columns <= 0 && *Rows <= 0) {
|
if (*Columns <= 0 && *Rows <= 0) {
|
||||||
return EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Done;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
Done:
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1113,16 +1127,19 @@ GraphicsConsoleConOutSetMode (
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
GRAPHICS_CONSOLE_DEV *Private;
|
GRAPHICS_CONSOLE_DEV *Private;
|
||||||
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
|
||||||
UINT32 HorizontalResolution;
|
UINT32 HorizontalResolution;
|
||||||
UINT32 VerticalResolution;
|
UINT32 VerticalResolution;
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||||
UINT32 ColorDepth;
|
UINT32 ColorDepth;
|
||||||
UINT32 RefreshRate;
|
UINT32 RefreshRate;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
|
||||||
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
||||||
GraphicsOutput = Private->GraphicsOutput;
|
GraphicsOutput = Private->GraphicsOutput;
|
||||||
|
@ -1130,18 +1147,21 @@ GraphicsConsoleConOutSetMode (
|
||||||
ModeData = &(Private->ModeData[ModeNumber]);
|
ModeData = &(Private->ModeData[ModeNumber]);
|
||||||
|
|
||||||
if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
|
if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
|
||||||
return EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure the requested mode number is supported
|
// Make sure the requested mode number is supported
|
||||||
//
|
//
|
||||||
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
|
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
|
||||||
return EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
|
if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
|
||||||
return EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Attempt to allocate a line buffer for the requested mode number
|
// Attempt to allocate a line buffer for the requested mode number
|
||||||
|
@ -1156,7 +1176,7 @@ GraphicsConsoleConOutSetMode (
|
||||||
// The new line buffer could not be allocated, so return an error.
|
// The new line buffer could not be allocated, so return an error.
|
||||||
// No changes to the state of the current console have been made, so the current console is still valid
|
// No changes to the state of the current console have been made, so the current console is still valid
|
||||||
//
|
//
|
||||||
return Status;
|
goto Done;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// If the mode has been set at least one other time, then LineBuffer will not be NULL
|
// If the mode has been set at least one other time, then LineBuffer will not be NULL
|
||||||
|
@ -1172,7 +1192,8 @@ GraphicsConsoleConOutSetMode (
|
||||||
//
|
//
|
||||||
if ((INT32) ModeNumber == This->Mode->Mode) {
|
if ((INT32) ModeNumber == This->Mode->Mode) {
|
||||||
gBS->FreePool (NewLineBuffer);
|
gBS->FreePool (NewLineBuffer);
|
||||||
return EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Otherwise, the size of the text console and/or the UGA mode will be changed,
|
// Otherwise, the size of the text console and/or the UGA mode will be changed,
|
||||||
|
@ -1197,7 +1218,7 @@ GraphicsConsoleConOutSetMode (
|
||||||
//
|
//
|
||||||
// The mode set operation failed
|
// The mode set operation failed
|
||||||
//
|
//
|
||||||
return Status;
|
goto Done;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -1242,7 +1263,7 @@ GraphicsConsoleConOutSetMode (
|
||||||
//
|
//
|
||||||
// The mode set operation failed
|
// The mode set operation failed
|
||||||
//
|
//
|
||||||
return Status;
|
goto Done;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
|
@ -1274,7 +1295,11 @@ GraphicsConsoleConOutSetMode (
|
||||||
This->SetCursorPosition (This, 0, 0);
|
This->SetCursorPosition (This, 0, 0);
|
||||||
This->EnableCursor (This, TRUE);
|
This->EnableCursor (This, TRUE);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
Done:
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1308,6 +1333,8 @@ GraphicsConsoleConOutSetAttribute (
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
if ((Attribute | 0xFF) != 0xFF) {
|
if ((Attribute | 0xFF) != 0xFF) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
@ -1316,12 +1343,16 @@ GraphicsConsoleConOutSetAttribute (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
This->Mode->Attribute = (INT32) Attribute;
|
This->Mode->Attribute = (INT32) Attribute;
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,13 +1386,16 @@ GraphicsConsoleConOutClearScreen (
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
GRAPHICS_CONSOLE_DEV *Private;
|
GRAPHICS_CONSOLE_DEV *Private;
|
||||||
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
||||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
|
||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
|
||||||
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
||||||
GraphicsOutput = Private->GraphicsOutput;
|
GraphicsOutput = Private->GraphicsOutput;
|
||||||
|
@ -1402,6 +1436,8 @@ GraphicsConsoleConOutClearScreen (
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1441,16 +1477,24 @@ GraphicsConsoleConOutSetCursorPosition (
|
||||||
{
|
{
|
||||||
GRAPHICS_CONSOLE_DEV *Private;
|
GRAPHICS_CONSOLE_DEV *Private;
|
||||||
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
|
||||||
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
|
||||||
ModeData = &(Private->ModeData[This->Mode->Mode]);
|
ModeData = &(Private->ModeData[This->Mode->Mode]);
|
||||||
|
|
||||||
if ((Column >= ModeData->Columns) || (Row >= ModeData->Rows)) {
|
if ((Column >= ModeData->Columns) || (Row >= ModeData->Rows)) {
|
||||||
return EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {
|
if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {
|
||||||
return EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
@ -1460,7 +1504,10 @@ GraphicsConsoleConOutSetCursorPosition (
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
Done:
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1492,12 +1539,17 @@ GraphicsConsoleConOutEnableCursor (
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
|
EFI_TPL OldTpl;
|
||||||
|
|
||||||
|
OldTpl = gBS->RaiseTPL (EFI_TPL_NOTIFY);
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
This->Mode->CursorVisible = Visible;
|
This->Mode->CursorVisible = Visible;
|
||||||
|
|
||||||
EraseCursor (This);
|
EraseCursor (This);
|
||||||
|
|
||||||
|
gBS->RestoreTPL (OldTpl);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue