summaryrefslogtreecommitdiff
path: root/EdkNt32Pkg/Dxe/WinNtThunk/Bus
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-30 06:15:19 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2007-03-30 06:15:19 +0000
commitfa332de7493caee4d3fa22392dc6292cfbb6f224 (patch)
tree3067198e303277699f3879d8d25e66c0254979a8 /EdkNt32Pkg/Dxe/WinNtThunk/Bus
parentdb29f969a9eb430eb81fd027614d4933c1d450e1 (diff)
downloadedk2-fa332de7493caee4d3fa22392dc6292cfbb6f224.zip
edk2-fa332de7493caee4d3fa22392dc6292cfbb6f224.tar.gz
edk2-fa332de7493caee4d3fa22392dc6292cfbb6f224.tar.bz2
1. Perfect libraries MSA files
2. Use MemoryAllocationLib to replace gBS memory services in EdkEt32Pkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2517 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkNt32Pkg/Dxe/WinNtThunk/Bus')
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c4
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c12
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c30
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c36
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c14
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c50
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c84
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c332
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa3
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c37
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c62
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c35
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa3
18 files changed, 292 insertions, 425 deletions
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
index dd81578..83532e2 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, 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
@@ -148,7 +148,7 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
*ErrorType = &gEfiBlockIoProtocolGuid;
*BufferSize = 0x60;
- gBS->AllocatePool (EfiBootServicesData, (UINTN) (*BufferSize), Buffer);
+ Buffer = AllocatePool ((UINTN) (*BufferSize));
CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);
return EFI_DEVICE_ERROR;
}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
index 5e7a985..5666ec2 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
@@ -346,7 +346,7 @@ Returns:
//
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
return Status;
@@ -430,12 +430,8 @@ Returns:
WinNtIo->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS);
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_BLOCK_IO_PRIVATE),
- &Private
- );
- ASSERT_EFI_ERROR (Status);
+ Private = AllocatePool (sizeof (WIN_NT_BLOCK_IO_PRIVATE));
+ ASSERT (Private != NULL);
EfiInitializeLock (&Private->Lock, EFI_TPL_NOTIFY);
@@ -518,7 +514,7 @@ Returns:
);
if (EFI_ERROR (Status)) {
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
DEBUG ((EFI_D_INIT, "BlockDevice added: %s\n", Filename));
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
index 3051845..e6ba0f0 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
@@ -46,6 +46,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtBlockIo.h</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
index 0027069..e32ffe8 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
@@ -1,13 +1,13 @@
/*++
-Copyright (c) 2006, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
@@ -15,7 +15,7 @@ Module Name:
Abstract:
- Console based on Win32 APIs.
+ Console based on Win32 APIs.
--*/
@@ -164,12 +164,8 @@ Returns:
return Status;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA),
- &Private
- );
- if (EFI_ERROR (Status)) {
+ Private = AllocatePool (sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA));
+ if (Private == NULL) {
goto Done;
}
@@ -214,7 +210,7 @@ Done:
gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
}
- gBS->FreePool (Private);
+ FreePool (Private);
}
return Status;
@@ -300,7 +296,7 @@ Returns:
//
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
return Status;
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
index 3af1ce6..a4e2b3f 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
@@ -1,13 +1,13 @@
/*++
-Copyright (c) 2006, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
@@ -15,15 +15,15 @@ Module Name:
Abstract:
- Console based on Win32 APIs.
+ Console based on Win32 APIs.
This file attaches a SimpleTextIn protocol to a previously open window.
-
+
The constructor for this protocol depends on an open window. Currently
the SimpleTextOut protocol creates a window when it's constructor is called.
- Thus this code must run after the constructor for the SimpleTextOut
+ Thus this code must run after the constructor for the SimpleTextOut
protocol
-
+
--*/
#include "Console.h"
@@ -102,7 +102,7 @@ Returns:
} else {
return EFI_NOT_READY;
}
-
+
//
// Check to see if we should return a scan code in place of Unicode character.
//
@@ -280,12 +280,8 @@ Returns:
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (INPUT_RECORD) * NtEventCount,
- &InputRecord
- );
- if (EFI_ERROR (Status)) {
+ InputRecord = AllocatePool (sizeof (INPUT_RECORD) * NtEventCount);
+ if (InputRecord == NULL) {
Status = EFI_NOT_READY;
goto Done;
}
@@ -315,7 +311,7 @@ Returns:
Done:
if (InputRecord != NULL) {
- gBS->FreePool (InputRecord);
+ FreePool (InputRecord);
}
return Status;
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
index 8d8375b..f60a5d1 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
@@ -43,6 +43,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>Console.h</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
index d820d9a..3874252 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
@@ -46,6 +46,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtGopScreen.c</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
index 6013165..bf2abc4 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007, 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
@@ -125,12 +125,8 @@ WinNtGopDriverBindingStart (
// Allocate Private context data for SGO inteface.
//
Private = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (GOP_PRIVATE_DATA),
- &Private
- );
- if (EFI_ERROR (Status)) {
+ Private = AllocatePool (sizeof (GOP_PRIVATE_DATA));
+ if (Private == NULL) {
goto Done;
}
//
@@ -185,7 +181,7 @@ Done:
FreeUnicodeStringTable (Private->ControllerNameTable);
}
- gBS->FreePool (Private);
+ FreePool (Private);
}
}
@@ -270,7 +266,7 @@ WinNtGopDriverBindingStop (
//
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
index 47d849b..89a5e4d 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
@@ -85,7 +85,6 @@ WinNtGopQuerytMode (
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
)
{
- EFI_STATUS Status;
GOP_PRIVATE_DATA *Private;
Private = GOP_PRIVATE_DATA_FROM_THIS (This);
@@ -94,13 +93,9 @@ WinNtGopQuerytMode (
return EFI_INVALID_PARAMETER;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
- Info
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
+ if (*Info == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
@@ -242,17 +237,13 @@ WinNtGopSetMode (
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution,
- &NewFillLine
- );
- if (EFI_ERROR (Status)) {
+ NewFillLine = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution);
+ if (NewFillLine == NULL) {
return EFI_DEVICE_ERROR;
}
if (Private->FillLine != NULL) {
- gBS->FreePool (Private->FillLine);
+ FreePool (Private->FillLine);
}
Private->FillLine = NewFillLine;
@@ -637,7 +628,7 @@ WinNtGopThreadWindowProc (
case VK_F8: Key.ScanCode = SCAN_F8; break;
case VK_F9: Key.ScanCode = SCAN_F9; break;
case VK_F11: Key.ScanCode = SCAN_F11; break;
- case VK_F12: Key.ScanCode = SCAN_F12; break;
+ case VK_F12: Key.ScanCode = SCAN_F12; break;
}
if (Key.ScanCode != 0) {
@@ -885,8 +876,6 @@ WinNtGopConstructor (
GOP_PRIVATE_DATA *Private
)
{
- EFI_STATUS Status;
-
Private->ModeData = mGopModeData;
Private->GraphicsOutput.QueryMode = WinNtGopQuerytMode;
@@ -896,22 +885,15 @@ WinNtGopConstructor (
//
// Allocate buffer for Graphics Output Protocol mode information
//
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE),
- (VOID **) &Private->GraphicsOutput.Mode
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ Private->GraphicsOutput.Mode = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE));
+ if (Private->GraphicsOutput.Mode == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
- (VOID **) &Private->GraphicsOutput.Mode->Info
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ Private->GraphicsOutput.Mode->Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
+ if (Private->GraphicsOutput.Mode->Info == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
+
Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
//
// Till now, we have no idea about the window size.
@@ -982,9 +964,9 @@ WinNtGopDestructor (
//
if (Private->GraphicsOutput.Mode != NULL) {
if (Private->GraphicsOutput.Mode->Info != NULL) {
- gBS->FreePool (Private->GraphicsOutput.Mode->Info);
+ FreePool (Private->GraphicsOutput.Mode->Info);
}
- gBS->FreePool (Private->GraphicsOutput.Mode);
+ FreePool (Private->GraphicsOutput.Mode);
}
return EFI_SUCCESS;
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
index a4a7a32..3de4a86 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
@@ -1,13 +1,13 @@
/*++
-Copyright (c) 2006, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
@@ -20,7 +20,7 @@ Abstract:
Handle(1) - WinNtIo - DevicePath(1)
- If a serial port is added to the system this driver creates a new handle.
+ If a serial port is added to the system this driver creates a new handle.
The new handle is required, since the serial device must add an UART device
pathnode.
@@ -32,15 +32,15 @@ Abstract:
Handle(1) - WinNtIo - DevicePath(1) - WinNtSerialPort
- If the driver is unloaded Handle(2) is removed from the system and
+ If the driver is unloaded Handle(2) is removed from the system and
gEfiWinNtSerialPortGuid is removed from Handle(1).
Note: Handle(1) is any handle created by the Win NT Bus driver that is passed
into the DriverBinding member functions of this driver. This driver requires
- a Handle(1) to contain a WinNtIo protocol, a DevicePath protocol, and
- the TypeGuid in the WinNtIo must be gEfiWinNtSerialPortGuid.
-
- If Handle(1) contains a gEfiWinNtSerialPortGuid protocol then the driver is
+ a Handle(1) to contain a WinNtIo protocol, a DevicePath protocol, and
+ the TypeGuid in the WinNtIo must be gEfiWinNtSerialPortGuid.
+
+ If Handle(1) contains a gEfiWinNtSerialPortGuid protocol then the driver is
loaded on the device.
--*/
@@ -135,7 +135,7 @@ Returns:
Status = EFI_UNSUPPORTED;
goto Error;
}
-
+
//
// Check the GUID to see if this is a handle type the driver supports
//
@@ -309,7 +309,7 @@ Returns:
}
}
- gBS->FreePool (OpenInfoBuffer);
+ FreePool (OpenInfoBuffer);
return Status;
}
@@ -334,12 +334,8 @@ Returns:
//
// Construct Private data
//
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA),
- &Private
- );
- if (EFI_ERROR (Status)) {
+ Private = AllocatePool (sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA));
+ if (Private == NULL) {
goto Error;
}
@@ -474,12 +470,12 @@ Error:
}
if (Private->DevicePath != NULL) {
- gBS->FreePool (Private->DevicePath);
+ FreePool (Private->DevicePath);
}
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
}
@@ -592,11 +588,11 @@ Returns:
} else {
Private->WinNtThunk->CloseHandle (Private->NtHandle);
- gBS->FreePool (Private->DevicePath);
+ FreePool (Private->DevicePath);
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
}
@@ -683,7 +679,7 @@ Routine Description:
Arguments:
- This - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue.
+ This - A pointer to the EFI_SERIAL_IO_PROTOCOL structrue.
BaudRate - The Baud rate of the serial device.
ReceiveFifoDepth - The request depth of fifo on receive side.
Timeout - the request timeout for a single charact.
@@ -869,7 +865,7 @@ Returns:
}
if (Private->DevicePath != NULL) {
- gBS->FreePool (Private->DevicePath);
+ FreePool (Private->DevicePath);
}
Private->DevicePath = NewDevicePath;
@@ -1029,7 +1025,7 @@ Returns:
if (ModemStatus & MS_RLSD_ON) {
Bits |= EFI_SERIAL_CARRIER_DETECT;
}
-
+
//
// Get ctrl status
//
@@ -1059,7 +1055,7 @@ Returns:
if (Private->HardwareLoopbackEnable) {
Bits |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
}
-
+
//
// Get input buffer status
//
@@ -1145,7 +1141,7 @@ Returns:
Control |= EFI_SERIAL_REQUEST_TO_SEND;
WinNtSerialIoSetControl (&Private->SerialIo, Control);
}
-
+
//
// Do the write
//
@@ -1285,10 +1281,10 @@ IsaSerialFifoFull (
Routine Description:
Detect whether specific FIFO is full or not
-
+
Arguments:
Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
-
+
Returns:
TRUE: the FIFO is full
FALSE: the FIFO is not full
@@ -1310,10 +1306,10 @@ IsaSerialFifoEmpty (
Routine Description:
Detect whether specific FIFO is empty or not
-
+
Arguments:
Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
-
+
Returns:
TRUE: the FIFO is empty
FALSE: the FIFO is not empty
@@ -1336,14 +1332,14 @@ IsaSerialFifoAdd (
Routine Description:
Add data to specific FIFO
-
+
Arguments:
Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
- Data UINT8: the data added to FIFO
-
+ Data UINT8: the data added to FIFO
+
Returns:
EFI_SUCCESS: Add data to specific FIFO successfully
- EFI_OUT_RESOURCE: Failed to add data because FIFO is already full
+ EFI_OUT_RESOURCE: Failed to add data because FIFO is already full
--*/
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
@@ -1354,7 +1350,7 @@ IsaSerialFifoAdd (
if (IsaSerialFifoFull (Fifo)) {
return EFI_OUT_OF_RESOURCES;
}
-
+
//
// FIFO is not full can add data
//
@@ -1377,11 +1373,11 @@ IsaSerialFifoRemove (
Routine Description:
Remove data from specific FIFO
-
+
Arguments:
Fifo SERIAL_DEV_FIFO *: A pointer to the Data Structure SERIAL_DEV_FIFO
- Data UINT8*: the data removed from FIFO
-
+ Data UINT8*: the data removed from FIFO
+
Returns:
EFI_SUCCESS: Remove data from specific FIFO successfully
EFI_OUT_RESOURCE: Failed to remove data because FIFO is empty
@@ -1395,7 +1391,7 @@ IsaSerialFifoRemove (
if (IsaSerialFifoEmpty (Fifo)) {
return EFI_OUT_OF_RESOURCES;
}
-
+
//
// FIFO is not empty, can remove data
//
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
index 63614a1..e2cf66e 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
@@ -47,6 +47,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtSerialIo.h</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
index d55a153..28fd819 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
@@ -1,13 +1,13 @@
/*++
-Copyright (c) 2006 - 2007, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
@@ -16,8 +16,8 @@ Module Name:
Abstract:
Produce Simple File System abstractions for directories on your PC using Win32 APIs.
- The configuration of what devices to mount or emulate comes from NT
- environment variables. The variables must be visible to the Microsoft*
+ The configuration of what devices to mount or emulate comes from NT
+ environment variables. The variables must be visible to the Microsoft*
Developer Studio for them to work.
* Other names and brands may be claimed as the property of others.
@@ -142,7 +142,7 @@ Returns:
for (Pointer = Str; *(Pointer + Count); Pointer++) {
*Pointer = *(Pointer + Count);
}
- *Pointer = *(Pointer + Count);
+ *Pointer = *(Pointer + Count);
}
}
@@ -284,12 +284,10 @@ Returns:
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE),
- &Private
- );
- if (EFI_ERROR (Status)) {
+ Private = AllocatePool (sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE));
+ if (Private == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+
goto Done;
}
@@ -298,14 +296,9 @@ Returns:
Private->FilePath = WinNtIo->EnvString;
- Private->VolumeLabel = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (L"EFI_EMULATED"),
- &Private->VolumeLabel
- );
-
- if (EFI_ERROR (Status)) {
+ Private->VolumeLabel = AllocatePool (StrSize (L"EFI_EMULATED"));
+ if (Private->VolumeLabel == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -339,7 +332,7 @@ Done:
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
gBS->CloseProtocol (
@@ -431,7 +424,7 @@ Returns:
//
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
return Status;
@@ -489,33 +482,21 @@ Returns:
Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);
- PrivateFile = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_EFI_FILE_PRIVATE),
- &PrivateFile
- );
- if (EFI_ERROR (Status)) {
+ PrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE));
+ if (PrivateFile == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- PrivateFile->FileName = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (Private->FilePath),
- &PrivateFile->FileName
- );
- if (EFI_ERROR (Status)) {
+ PrivateFile->FileName = AllocatePool (StrSize (Private->FilePath));
+ if (PrivateFile->FileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
- PrivateFile->FilePath = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (Private->FilePath),
- &PrivateFile->FilePath
- );
- if (EFI_ERROR (Status)) {
+ PrivateFile->FilePath = AllocatePool (StrSize (Private->FilePath));
+ if (PrivateFile->FilePath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -541,7 +522,7 @@ Returns:
PrivateFile->LHandle = INVALID_HANDLE_VALUE;
PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
PrivateFile->IsValidFindBuf = FALSE;
-
+
*Root = &PrivateFile->EfiFile;
Status = EFI_SUCCESS;
@@ -550,14 +531,14 @@ Done:
if (EFI_ERROR (Status)) {
if (PrivateFile) {
if (PrivateFile->FileName) {
- gBS->FreePool (PrivateFile->FileName);
+ FreePool (PrivateFile->FileName);
}
if (PrivateFile->FilePath) {
- gBS->FreePool (PrivateFile->FilePath);
+ FreePool (PrivateFile->FilePath);
}
- gBS->FreePool (PrivateFile);
+ FreePool (PrivateFile);
}
}
@@ -675,13 +656,9 @@ Returns:
//
// Allocate buffer for FileName as the passed in FileName may be read only
//
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (FileName),
- &TempFileName
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ TempFileName = AllocatePool (StrSize (FileName));
+ if (TempFileName == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
StrCpy (TempFileName, FileName);
FileName = TempFileName;
@@ -705,7 +682,7 @@ OpenRoot:
}
//
- // If file name does not equal to "." or "..",
+ // If file name does not equal to "." or "..",
// then we trim the leading/trailing blanks and trailing dots
//
if (StrCmp (FileName, L".") != 0 && StrCmp (FileName, L"..") != 0) {
@@ -722,7 +699,7 @@ OpenRoot:
//
// Trim trailing dots and blanks
//
- for (TempFileName = FileName + StrLen (FileName) - 1;
+ for (TempFileName = FileName + StrLen (FileName) - 1;
TempFileName >= FileName && (*TempFileName == L' ' || *TempFileName == L'.');
TempFileName--) {
;
@@ -733,27 +710,17 @@ OpenRoot:
//
// Attempt to open the file
//
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_EFI_FILE_PRIVATE),
- &NewPrivateFile
- );
-
- if (EFI_ERROR (Status)) {
+ NewPrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE));
+ if (NewPrivateFile == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
CopyMem (NewPrivateFile, PrivateFile, sizeof (WIN_NT_EFI_FILE_PRIVATE));
- NewPrivateFile->FilePath = NULL;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateFile->FileName),
- &NewPrivateFile->FilePath
- );
-
- if (EFI_ERROR (Status)) {
+ NewPrivateFile->FilePath = AllocatePool (StrSize (PrivateFile->FileName));
+ if (NewPrivateFile->FilePath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -763,14 +730,9 @@ OpenRoot:
StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath);
}
- NewPrivateFile->FileName = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName),
- &NewPrivateFile->FileName
- );
-
- if (EFI_ERROR (Status)) {
+ NewPrivateFile->FileName = AllocatePool (StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName));
+ if (NewPrivateFile->FileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -783,7 +745,7 @@ OpenRoot:
if (StrCmp (FileName, L"") != 0) {
//
// In case the filename becomes empty, especially after trimming dots and blanks
- //
+ //
StrCat (NewPrivateFile->FileName, L"\\");
StrCat (NewPrivateFile->FileName, FileName);
}
@@ -847,9 +809,9 @@ OpenRoot:
if (StrCmp (NewPrivateFile->FileName, PrivateRoot->FilePath) == 0) {
NewPrivateFile->IsRootDirectory = TRUE;
- gBS->FreePool (NewPrivateFile->FilePath);
- gBS->FreePool (NewPrivateFile->FileName);
- gBS->FreePool (NewPrivateFile);
+ FreePool (NewPrivateFile->FilePath);
+ FreePool (NewPrivateFile->FileName);
+ FreePool (NewPrivateFile);
goto OpenRoot;
}
@@ -861,15 +823,11 @@ OpenRoot:
TempChar = *(RealFileName - 1);
*(RealFileName - 1) = 0;
- gBS->FreePool (NewPrivateFile->FilePath);
+ FreePool (NewPrivateFile->FilePath);
NewPrivateFile->FilePath = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewPrivateFile->FileName),
- &NewPrivateFile->FilePath
- );
-
- if (EFI_ERROR (Status)) {
+ NewPrivateFile->FilePath = AllocatePool (StrSize (NewPrivateFile->FileName));
+ if (NewPrivateFile->FilePath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -923,13 +881,9 @@ OpenRoot:
//
if (NewPrivateFile->IsDirectoryPath) {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewPrivateFile->FileName) + StrSize (L"\\*"),
- &TempFileName
- );
-
- if (EFI_ERROR (Status)) {
+ TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*"));
+ if (TempFileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -943,7 +897,7 @@ OpenRoot:
LastError = PrivateFile->WinNtThunk->GetLastError ();
if (LastError != ERROR_ALREADY_EXISTS) {
- gBS->FreePool (TempFileName);
+ FreePool (TempFileName);
Status = EFI_ACCESS_DENIED;
goto Done;
}
@@ -1059,13 +1013,9 @@ OpenRoot:
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- InfoSize,
- &Info
- );
-
- if (EFI_ERROR (Status)) {
+ Info = AllocatePool (InfoSize);
+ if (Info == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -1081,19 +1031,19 @@ OpenRoot:
}
Done: ;
- gBS->FreePool (FileName);
+ FreePool (FileName);
if (EFI_ERROR (Status)) {
if (NewPrivateFile) {
if (NewPrivateFile->FileName) {
- gBS->FreePool (NewPrivateFile->FileName);
+ FreePool (NewPrivateFile->FileName);
}
if (NewPrivateFile->FilePath) {
- gBS->FreePool (NewPrivateFile->FilePath);
+ FreePool (NewPrivateFile->FilePath);
}
- gBS->FreePool (NewPrivateFile);
+ FreePool (NewPrivateFile);
}
} else {
*NewHandle = &NewPrivateFile->EfiFile;
@@ -1132,7 +1082,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
@@ -1151,13 +1101,13 @@ Returns:
}
if (PrivateFile->FileName) {
- gBS->FreePool (PrivateFile->FileName);
+ FreePool (PrivateFile->FileName);
}
- gBS->FreePool (PrivateFile);
+ FreePool (PrivateFile);
gBS->RestoreTPL (OldTpl);
-
+
return EFI_SUCCESS;
}
@@ -1194,7 +1144,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
Status = EFI_WARN_DELETE_FAILURE;
@@ -1223,8 +1173,8 @@ Returns:
}
}
- gBS->FreePool (PrivateFile->FileName);
- gBS->FreePool (PrivateFile);
+ FreePool (PrivateFile->FileName);
+ FreePool (PrivateFile);
gBS->RestoreTPL (OldTpl);
@@ -1328,7 +1278,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
@@ -1344,11 +1294,7 @@ Returns:
}
FileInfoSize = SIZE_OF_EFI_FILE_SYSTEM_INFO;
- gBS->AllocatePool (
- EfiBootServicesData,
- FileInfoSize,
- &FileInfo
- );
+ FileInfo = AllocatePool (FileInfoSize);
Status = This->GetInfo (
This,
@@ -1358,12 +1304,8 @@ Returns:
);
if (Status == EFI_BUFFER_TOO_SMALL) {
- gBS->FreePool (FileInfo);
- gBS->AllocatePool (
- EfiBootServicesData,
- FileInfoSize,
- &FileInfo
- );
+ FreePool (FileInfo);
+ FileInfo = AllocatePool (FileInfoSize);
Status = This->GetInfo (
This,
&gEfiFileInfoGuid,
@@ -1379,7 +1321,7 @@ Returns:
FileSize = FileInfo->FileSize;
- gBS->FreePool (FileInfo);
+ FreePool (FileInfo);
if (Pos >= FileSize) {
*BufferSize = 0;
@@ -1545,7 +1487,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
@@ -1619,7 +1561,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
if (PrivateFile->IsDirectoryPath) {
@@ -1628,13 +1570,9 @@ Returns:
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateFile->FileName) + StrSize (L"\\*"),
- &FileName
- );
-
- if (EFI_ERROR (Status)) {
+ FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*"));
+ if (FileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -1653,7 +1591,7 @@ Returns:
PrivateFile->IsValidFindBuf = TRUE;
}
- gBS->FreePool (FileName);
+ FreePool (FileName);
Status = (PrivateFile->LHandle == INVALID_HANDLE_VALUE) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
} else {
@@ -1956,14 +1894,10 @@ Returns:
//
// Try to get the drive name
//
- DriveName = NULL;
DriveNameFound = FALSE;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateFile->FilePath) + 1,
- &DriveName
- );
- if (EFI_ERROR (Status)) {
+ DriveName = AllocatePool (StrSize (PrivateFile->FilePath) + 1);
+ if (DriveName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2003,7 +1937,7 @@ Returns:
&TotalClusters
);
if (DriveName) {
- gBS->FreePool (DriveName);
+ FreePool (DriveName);
}
if (NtStatus) {
@@ -2161,16 +2095,10 @@ Returns:
NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;
- gBS->FreePool (PrivateRoot->VolumeLabel);
-
- PrivateRoot->VolumeLabel = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewFileSystemInfo->VolumeLabel),
- &PrivateRoot->VolumeLabel
- );
-
- if (EFI_ERROR (Status)) {
+ FreePool (PrivateRoot->VolumeLabel);
+ PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));
+ if (PrivateRoot->VolumeLabel == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2240,9 +2168,9 @@ Returns:
goto Done;
}
- Status = gBS->AllocatePool (EfiBootServicesData, OldInfoSize, &OldFileInfo);
-
- if (EFI_ERROR (Status)) {
+ OldFileInfo = AllocatePool (OldInfoSize);
+ if (OldFileInfo == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2252,13 +2180,9 @@ Returns:
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateFile->FileName),
- &OldFileName
- );
-
- if (EFI_ERROR (Status)) {
+ OldFileName = AllocatePool (StrSize (PrivateFile->FileName));
+ if (OldFileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2268,13 +2192,9 @@ Returns:
// Make full pathname from new filename and rootpath.
//
if (NewFileInfo->FileName[0] == '\\') {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName),
- &NewFileName
- );
-
- if (EFI_ERROR (Status)) {
+ NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));
+ if (NewFileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2282,13 +2202,9 @@ Returns:
StrCat (NewFileName, L"\\");
StrCat (NewFileName, NewFileInfo->FileName + 1);
} else {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName),
- &NewFileName
- );
-
- if (EFI_ERROR (Status)) {
+ NewFileName = AllocatePool (StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));
+ if (NewFileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
@@ -2394,30 +2310,22 @@ Returns:
//
// modify file name
//
- gBS->FreePool (PrivateFile->FileName);
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewFileName),
- &PrivateFile->FileName
- );
+ FreePool (PrivateFile->FileName);
- if (EFI_ERROR (Status)) {
+ PrivateFile->FileName = AllocatePool (StrSize (NewFileName));
+ if (PrivateFile->FileName == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
StrCpy (PrivateFile->FileName, NewFileName);
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (NewFileName) + StrSize (L"\\*"),
- &TempFileName
- );
+ TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*"));
StrCpy (TempFileName, NewFileName);
if (!PrivateFile->IsDirectoryPath) {
- PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (
+ PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (
TempFileName,
PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -2427,7 +2335,7 @@ Returns:
NULL
);
- gBS->FreePool (TempFileName);
+ FreePool (TempFileName);
//
// Flush buffers just in case
@@ -2450,7 +2358,7 @@ Returns:
StrCat (TempFileName, L"\\*");
PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);
- gBS->FreePool (TempFileName);
+ FreePool (TempFileName);
}
} else {
Reopen: ;
@@ -2462,11 +2370,7 @@ Reopen: ;
goto Done;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- StrSize (OldFileName) + StrSize (L"\\*"),
- &TempFileName
- );
+ TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*"));
StrCpy (TempFileName, OldFileName);
@@ -2495,7 +2399,7 @@ Reopen: ;
PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);
}
- gBS->FreePool (TempFileName);
+ FreePool (TempFileName);
goto Done;
@@ -2637,15 +2541,15 @@ Reopen: ;
Done:
if (OldFileInfo != NULL) {
- gBS->FreePool (OldFileInfo);
+ FreePool (OldFileInfo);
}
if (OldFileName != NULL) {
- gBS->FreePool (OldFileName);
+ FreePool (OldFileName);
}
if (NewFileName != NULL) {
- gBS->FreePool (NewFileName);
+ FreePool (NewFileName);
}
gBS->RestoreTPL (OldTpl);
@@ -2696,7 +2600,7 @@ Returns:
}
OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK);
-
+
PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
index 725d7d0..6c0ef48 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
@@ -46,6 +46,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtSimpleFileSystem.h</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
index 13c3829..86b667b 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
@@ -43,6 +43,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtUga.h</Filename>
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
index a270ec7..5208560 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
@@ -1,13 +1,13 @@
/*++
-Copyright (c) 2006, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
@@ -19,9 +19,9 @@ Abstract:
UGA is short hand for Universal Graphics Abstraction protocol.
- This file is a verision of UgaIo the uses WinNtThunk system calls as an IO
+ This file is a verision of UgaIo the uses WinNtThunk system calls as an IO
abstraction. For a PCI device WinNtIo would be replaced with
- a PCI IO abstraction that abstracted a specific PCI device.
+ a PCI IO abstraction that abstracted a specific PCI device.
--*/
@@ -137,13 +137,8 @@ Returns:
//
// Allocate Private context data for SGO inteface.
//
- Private = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (UGA_PRIVATE_DATA),
- &Private
- );
- if (EFI_ERROR (Status)) {
+ Private = AllocatePool (sizeof (UGA_PRIVATE_DATA));
+ if (Private == NULL) {
goto Done;
}
//
@@ -198,7 +193,7 @@ Done:
FreeUnicodeStringTable (Private->ControllerNameTable);
}
- gBS->FreePool (Private);
+ FreePool (Private);
}
}
@@ -287,7 +282,7 @@ Returns:
//
FreeUnicodeStringTable (Private->ControllerNameTable);
- gBS->FreePool (Private);
+ FreePool (Private);
}
@@ -308,9 +303,9 @@ Arguments:
String - Unicode string.
-Returns:
+Returns:
- UINTN of the number represented by String.
+ UINTN of the number represented by String.
--*/
{
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
index 7d40eb7..b6c1ce2 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
@@ -1,22 +1,22 @@
/*++
-Copyright (c) 2006 - 2007, 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.
+Copyright (c) 2006 - 2007, 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.
Module Name:
-
+
WinNtUgaScreen.c
Abstract:
- This file produces the graphics abstration of UGA. It is called by
- WinNtUgaDriver.c file which deals with the EFI 1.1 driver model.
+ This file produces the graphics abstration of UGA. It is called by
+ WinNtUgaDriver.c file which deals with the EFI 1.1 driver model.
This file just does graphics.
--*/
@@ -72,7 +72,7 @@ WinNtUgaGetMode (
Returns:
EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
EFI_INVALID_PARAMETER - One of the input args was NULL.
--*/
@@ -123,7 +123,7 @@ WinNtUgaSetMode (
Returns:
EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
+ EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
EFI_INVALID_PARAMETER - One of the input args was NULL.
--*/
@@ -224,17 +224,13 @@ WinNtUgaSetMode (
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_UGA_PIXEL) * HorizontalResolution,
- &NewFillLine
- );
- if (EFI_ERROR (Status)) {
+ NewFillLine = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution);
+ if (NewFillLine == NULL) {
return EFI_DEVICE_ERROR;
}
if (Private->FillLine != NULL) {
- gBS->FreePool (Private->FillLine);
+ FreePool (Private->FillLine);
}
Private->FillLine = NewFillLine;
@@ -281,19 +277,19 @@ WinNtUgaBlt (
Routine Description:
Blt pixels from the rectangle (Width X Height) formed by the BltBuffer
onto the graphics screen starting a location (X, Y). (0, 0) is defined as
- the upper left hand side of the screen. (X, Y) can be outside of the
- current screen geometry and the BltBuffer will be cliped when it is
- displayed. X and Y can be negative or positive. If Width or Height is
+ the upper left hand side of the screen. (X, Y) can be outside of the
+ current screen geometry and the BltBuffer will be cliped when it is
+ displayed. X and Y can be negative or positive. If Width or Height is
bigger than the current video screen the image will be clipped.
Arguments:
This - Protocol instance pointer.
- X - X location on graphics screen.
+ X - X location on graphics screen.
Y - Y location on the graphics screen.
Width - Width of BltBuffer.
Height - Hight of BltBuffer
BltOperation - Operation to perform on BltBuffer and video memory
- BltBuffer - Buffer containing data to blt into video buffer. This
+ BltBuffer - Buffer containing data to blt into video buffer. This
buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
SourceX - If the BltOperation is a EfiCopyBlt this is the source
of the copy. For other BLT operations this argument is not
@@ -301,11 +297,11 @@ WinNtUgaBlt (
SourceX - If the BltOperation is a EfiCopyBlt this is the source
of the copy. For other BLT operations this argument is not
used.
-
+
Returns:
EFI_SUCCESS - The palette is updated with PaletteArray.
EFI_INVALID_PARAMETER - BltOperation is not valid.
- EFI_DEVICE_ERROR - A hardware error occured writting to the video
+ EFI_DEVICE_ERROR - A hardware error occured writting to the video
buffer.
--*/
@@ -445,7 +441,7 @@ WinNtUgaBlt (
// we may miss some data for a short period of time this is no different than
// a write combining on writes to a frame buffer.
//
-
+
Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
}
@@ -501,7 +497,7 @@ WinNtUgaThreadWindowProc (
/*++
Routine Description:
- Win32 Windows event handler.
+ Win32 Windows event handler.
Arguments:
See Win32 Book
@@ -631,7 +627,7 @@ Returns:
case VK_F8: Key.ScanCode = SCAN_F8; break;
case VK_F9: Key.ScanCode = SCAN_F9; break;
case VK_F11: Key.ScanCode = SCAN_F11; break;
- case VK_F12: Key.ScanCode = SCAN_F12; break;
+ case VK_F12: Key.ScanCode = SCAN_F12; break;
}
if (Key.ScanCode != 0) {
@@ -693,7 +689,7 @@ WinNtUgaThreadWinMain (
Routine Description:
This thread simulates the end of WinMain () aplication. Each Winow nededs
- to process it's events. The messages are dispatched to
+ to process it's events. The messages are dispatched to
WinNtUgaThreadWindowProc ().
Be very careful sine WinNtUgaThreadWinMain () and WinNtUgaThreadWindowProc ()
@@ -974,8 +970,8 @@ KillNtUgaThread (
/*++
Routine Description:
-
- This is the UGA screen's callback notification function for exit-boot-services.
+
+ This is the UGA screen's callback notification function for exit-boot-services.
All we do here is call WinNtUgaDestructor().
Arguments:
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
index 1e2b370..b0e1c2b 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
@@ -136,18 +136,11 @@ AllocateMemory (
IN UINTN Size
)
{
- EFI_STATUS Status;
VOID *Buffer;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- Size,
- (VOID *)&Buffer
- );
- if (EFI_ERROR (Status)) {
- ASSERT (FALSE);
- return NULL;
- }
+ Buffer = AllocatePool (Size);
+ ASSERT (Buffer != NULL);
+
return Buffer;
}
@@ -341,13 +334,9 @@ Returns:
}
if (Status != EFI_ALREADY_STARTED) {
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (WIN_NT_BUS_DEVICE),
- (VOID *) &WinNtBusDevice
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ WinNtBusDevice = AllocatePool (sizeof (WIN_NT_BUS_DEVICE));
+ if (WinNtBusDevice == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
WinNtBusDevice->Signature = WIN_NT_BUS_DEVICE_SIGNATURE;
@@ -368,7 +357,7 @@ Returns:
);
if (EFI_ERROR (Status)) {
FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);
- gBS->FreePool (WinNtBusDevice);
+ FreePool (WinNtBusDevice);
return Status;
}
}
@@ -464,7 +453,7 @@ Returns:
Count
);
if (WinNtDevice->DevicePath == NULL) {
- gBS->FreePool (WinNtDevice);
+ FreePool (WinNtDevice);
return EFI_OUT_OF_RESOURCES;
}
@@ -490,7 +479,7 @@ Returns:
);
if (EFI_ERROR (Status)) {
FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);
- gBS->FreePool (WinNtDevice);
+ FreePool (WinNtDevice);
} else {
//
// Open For Child Device
@@ -516,7 +505,7 @@ Returns:
StartString = SubString;
}
- gBS->FreePool (TempStr);
+ FreePool (TempStr);
}
return EFI_SUCCESS;
@@ -588,7 +577,7 @@ Returns:
FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);
- gBS->FreePool (WinNtBusDevice);
+ FreePool (WinNtBusDevice);
gBS->CloseProtocol (
ControllerHandle,
@@ -652,7 +641,7 @@ Returns:
// Close the child handle
//
FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);
- gBS->FreePool (WinNtDevice);
+ FreePool (WinNtDevice);
}
}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
index 61da7b0..39d6c7b 100644
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
+++ b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
@@ -51,6 +51,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DevicePathLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>MemoryAllocationLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>WinNtBusDriver.h</Filename>