summaryrefslogtreecommitdiff
path: root/EdkNt32Pkg/Dxe/WinNtThunk/Bus
diff options
context:
space:
mode:
Diffstat (limited to 'EdkNt32Pkg/Dxe/WinNtThunk/Bus')
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c197
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c338
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c186
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c1104
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h471
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa89
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c197
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c303
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h512
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c357
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c638
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa85
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c199
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h321
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa95
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c316
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c352
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c996
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c208
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c1406
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h513
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa87
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c204
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c2682
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h587
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa92
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c198
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h363
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa92
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c338
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c411
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c990
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c208
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c707
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h297
-rw-r--r--EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa186
36 files changed, 0 insertions, 16325 deletions
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
deleted file mode 100644
index fb9cc42492..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "WinNtBlockIo.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtBlockIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName = {
- WinNtBlockIoComponentNameGetDriverName,
- WinNtBlockIoComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtBlockIoDriverNameTable[] = {
- { "eng", L"Windows Block I/O Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtBlockIoComponentName.SupportedLanguages,
- mWinNtBlockIoDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- WIN_NT_BLOCK_IO_PRIVATE *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- &BlockIo,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-
- return LookupUnicodeString (
- Language,
- gWinNtBlockIoComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
deleted file mode 100644
index 672ea5ffd0..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- DriverConfiguration.c
-
-Abstract:
-
---*/
-
-#include "WinNtBlockIo.h"
-
-//
-// EFI Driver Configuration Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-//
-// EFI Driver Configuration Protocol
-//
-EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration = {
- WinNtBlockIoDriverConfigurationSetOptions,
- WinNtBlockIoDriverConfigurationOptionsValid,
- WinNtBlockIoDriverConfigurationForceDefaults,
- LANGUAGESUPPORTED
-};
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-/*++
-
- Routine Description:
- Allows the user to set controller specific options for a controller that a
- driver is currently managing.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.
- ControllerHandle - The handle of the controller to set options on.
- ChildHandle - The handle of the child controller to set options on. This
- is an optional parameter that may be NULL. It will be NULL
- for device drivers, and for a bus drivers that wish to set
- options for the bus controller. It will not be NULL for a
- bus driver that wishes to set options for one of its child
- controllers.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the user interface that should be
- presented to the user, and it must match one of the languages
- specified in SupportedLanguages. The number of languages
- supported by a driver is up to the driver writer.
- ActionRequired - A pointer to the action that the calling agent is required
- to perform when this function returns. See "Related
- Definitions" for a list of the actions that the calling
- agent is required to perform prior to accessing
- ControllerHandle again.
-
- Returns:
- EFI_SUCCESS - The driver specified by This successfully set the
- configuration options for the controller specified
- by ControllerHandle..
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ActionRequired is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support setting
- configuration options for the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
- EFI_DEVICE_ERROR - A device error occurred while attempt to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
- EFI_OUT_RESOURCES - There are not enough resources available to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
-
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {
- Status = EFI_SUCCESS;
- }
-
- SupportedLanguage += 3;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ActionRequired == NULL || ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &BlockIo,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- *ActionRequired = EfiDriverConfigurationActionNone;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-/*++
-
- Routine Description:
- Tests to see if a controller's current configuration options are valid.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL instance.
- ControllerHandle - The handle of the controller to test if it's current
- configuration options are valid.
- ChildHandle - The handle of the child controller to test if it's current
- configuration options are valid. This is an optional
- parameter that may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers that wish
- to test the configuration options for the bus controller.
- It will not be NULL for a bus driver that wishes to test
- configuration options for one of its child controllers.
-
- Returns:
- EFI_SUCCESS - The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has a valid set of configuration
- options.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by ControllerHandle
- and ChildHandle.
- EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has an invalid set of configuration
- options.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- if (ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &BlockIo,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-/*++
-
- Routine Description:
- Forces a driver to set the default configuration options for a controller.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL instance.
- ControllerHandle - The handle of the controller to force default configuration options on.
- ChildHandle - The handle of the child controller to force default configuration options on This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to force default configuration options for the bus controller. It will not be NULL for a bus driver that wishes to force default configuration options for one of its child controllers.
- DefaultType - The type of default configuration options to force on the controller specified by ControllerHandle and ChildHandle. See Table 9-1 for legal values. A DefaultType of 0x00000000 must be supported by this protocol.
- ActionRequired - A pointer to the action that the calling agent is required to perform when this function returns. See "Related Definitions" in Section 9.1for a list of the actions that the calling agent is required to perform prior to accessing ControllerHandle again.
-
- Returns:
- EFI_SUCCESS - The driver specified by This successfully forced the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ActionRequired is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support forcing the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the configuration type specified by DefaultType.
- EFI_DEVICE_ERROR - A device error occurred while attempt to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.
- EFI_OUT_RESOURCES - There are not enough resources available to force the default configuration options on the controller specified by ControllerHandle and ChildHandle.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- if (ActionRequired == NULL || ControllerHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &BlockIo,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- *ActionRequired = EfiDriverConfigurationActionNone;
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
deleted file mode 100644
index 83532e222b..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*++
-
-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:
-
- DriverDiagnostics.c
-
-Abstract:
-
---*/
-
-#include "WinNtBlockIo.h"
-
-//
-// EFI Driver Diagnostics Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- );
-
-//
-// EFI Driver Diagnostics Protocol
-//
-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics = {
- WinNtBlockIoDriverDiagnosticsRunDiagnostics,
- LANGUAGESUPPORTED
-};
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- )
-/*++
-
- Routine Description:
- Runs diagnostics on a controller.
-
- Arguments:
- This - A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL instance.
- ControllerHandle - The handle of the controller to run diagnostics on.
- ChildHandle - The handle of the child controller to run diagnostics on
- This is an optional parameter that may be NULL. It will
- be NULL for device drivers. It will also be NULL for a
- bus drivers that wish to run diagnostics on the bus
- controller. It will not be NULL for a bus driver that
- wishes to run diagnostics on one of its child controllers.
- DiagnosticType - Indicates type of diagnostics to perform on the controller
- specified by ControllerHandle and ChildHandle. See
- "Related Definitions" for the list of supported types.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language in which the optional
- error message should be returned in Buffer, and it must
- match one of the languages specified in SupportedLanguages.
- The number of languages supported by a driver is up to
- the driver writer.
- ErrorType - A GUID that defines the format of the data returned in
- Buffer.
- BufferSize - The size, in bytes, of the data returned in Buffer.
- Buffer - A buffer that contains a Null-terminated Unicode string
- plus some additional data whose format is defined by
- ErrorType. Buffer is allocated by this function with
- AllocatePool(), and it is the caller's responsibility
- to free it with a call to FreePool().
-
- Returns:
- EFI_SUCCESS - The controller specified by ControllerHandle and
- ChildHandle passed the diagnostic.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ErrorType is NULL.
- EFI_INVALID_PARAMETER - BufferType is NULL.
- EFI_INVALID_PARAMETER - Buffer is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support
- running diagnostics for the controller specified
- by ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- type of diagnostic specified by DiagnosticType.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to complete
- the diagnostics.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to return
- the status information in ErrorType, BufferSize,
- and Buffer.
- EFI_DEVICE_ERROR - The controller specified by ControllerHandle and
- ChildHandle did not pass the diagnostic.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- CHAR8 *SupportedLanguage;
-
- if (Language == NULL ||
- ErrorType == NULL ||
- Buffer == NULL ||
- ControllerHandle == NULL ||
- BufferSize == NULL) {
-
- return EFI_INVALID_PARAMETER;
- }
-
- SupportedLanguage = This->SupportedLanguages;
-
- Status = EFI_UNSUPPORTED;
- while (*SupportedLanguage != 0) {
- if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {
- Status = EFI_SUCCESS;
- break;
- }
-
- SupportedLanguage += 3;
- }
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- *ErrorType = NULL;
- *BufferSize = 0;
- if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
- *ErrorType = &gEfiBlockIoProtocolGuid;
- *BufferSize = 0x60;
- Buffer = AllocatePool ((UINTN) (*BufferSize));
- CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Validate controller handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &BlockIo,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- gWinNtBlockIoDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- return Status;
- } else if (Status != EFI_ALREADY_STARTED) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
deleted file mode 100644
index effc8fa81b..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
+++ /dev/null
@@ -1,1104 +0,0 @@
-/*++
-
-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:
-
- WinNtBlockIo.c
-
-Abstract:
-
- Produce block IO abstractions for real devices 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*
- Developer Studio for them to work.
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- NT envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_WIN_NT_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_WIN_NT_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use NT to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048
-
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#include "WinNtBlockIo.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding = {
- WinNtBlockIoDriverBindingSupported,
- WinNtBlockIoDriverBindingStart,
- WinNtBlockIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure the WinNtThunkProtocol is valid
- //
- Status = EFI_UNSUPPORTED;
- if (WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtVirtualDisksGuid) ||
- CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtPhysicalDisksGuid) ) {
- Status = EFI_SUCCESS;
- }
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_RAW_DISK_DEVICE_TYPE DiskType;
- UINT16 Buffer[FILENAME_BUFFER_SIZE];
- CHAR16 *Str;
- BOOLEAN RemovableMedia;
- BOOLEAN WriteProtected;
- UINTN NumberOfBlocks;
- UINTN BlockSize;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Set DiskType
- //
- if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtVirtualDisksGuid)) {
- DiskType = EfiWinNtVirtualDisks;
- } else if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtPhysicalDisksGuid)) {
- DiskType = EfiWinNtPhysicalDisks;
- } else {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Status = EFI_NOT_FOUND;
- Str = WinNtIo->EnvString;
- if (DiskType == EfiWinNtVirtualDisks) {
- WinNtIo->WinNtThunk->SPrintf (
- Buffer,
- sizeof (Buffer),
- L"Diskfile%d",
- WinNtIo->InstanceNumber
- );
- } else {
- if (*Str >= 'A' && *Str <= 'Z' || *Str >= 'a' && *Str <= 'z') {
- WinNtIo->WinNtThunk->SPrintf (Buffer, sizeof (Buffer), L"\\\\.\\%c:", *Str);
- } else {
- WinNtIo->WinNtThunk->SPrintf (Buffer, sizeof (Buffer), L"\\\\.\\PHYSICALDRIVE%c", *Str);
- }
-
- Str++;
- if (*Str != ':') {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- Str++;
- }
-
- if (*Str == 'R' || *Str == 'F') {
- RemovableMedia = (BOOLEAN) (*Str == 'R');
- Str++;
- if (*Str == 'O' || *Str == 'W') {
- WriteProtected = (BOOLEAN) (*Str == 'O');
- Str = GetNextElementPastTerminator (Str, ';');
-
- NumberOfBlocks = Atoi (Str);
- if (NumberOfBlocks != 0) {
- Str = GetNextElementPastTerminator (Str, ';');
- BlockSize = Atoi (Str);
- if (BlockSize != 0) {
- //
- // If we get here the variable is valid so do the work.
- //
- Status = WinNtBlockIoCreateMapping (
- WinNtIo,
- Handle,
- Buffer,
- WriteProtected,
- RemovableMedia,
- NumberOfBlocks,
- BlockSize,
- DiskType
- );
-
- }
- }
- }
- }
-
-Done:
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_UNSUPPORTED - TODO: Add description for return value
-
---*/
-{
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_STATUS Status;
- WIN_NT_BLOCK_IO_PRIVATE *Private;
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- &BlockIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
-
- //
- // BugBug: If we need to kick people off, we need to make Uninstall Close the handles.
- // We could pass in our image handle or FLAG our open to be closed via
- // Unistall (== to saying any CloseProtocol will close our open)
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- NULL
- );
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Shut down our device
- //
- Private->WinNtThunk->CloseHandle (Private->NtHandle);
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
-
- return Status;
-}
-
-STATIC
-CHAR16 *
-GetNextElementPastTerminator (
- IN CHAR16 *EnvironmentVariable,
- IN CHAR16 Terminator
- )
-/*++
-
-Routine Description:
-
- Worker function to parse environment variables.
-
-Arguments:
- EnvironmentVariable - Envirnment variable to parse.
-
- Terminator - Terminator to parse for.
-
-Returns:
-
- Pointer to next eliment past the first occurence of Terminator or the '\0'
- at the end of the string.
-
---*/
-{
- CHAR16 *Ptr;
-
- for (Ptr = EnvironmentVariable; *Ptr != '\0'; Ptr++) {
- if (*Ptr == Terminator) {
- Ptr++;
- break;
- }
- }
-
- return Ptr;
-}
-
-STATIC
-EFI_STATUS
-WinNtBlockIoCreateMapping (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo,
- IN EFI_HANDLE EfiDeviceHandle,
- IN CHAR16 *Filename,
- IN BOOLEAN ReadOnly,
- IN BOOLEAN RemovableMedia,
- IN UINTN NumberOfBlocks,
- IN UINTN BlockSize,
- IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- WinNtIo - TODO: add argument description
- EfiDeviceHandle - TODO: add argument description
- Filename - TODO: add argument description
- ReadOnly - TODO: add argument description
- RemovableMedia - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
- BlockSize - TODO: add argument description
- DeviceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- WIN_NT_BLOCK_IO_PRIVATE *Private;
- UINTN Index;
-
- WinNtIo->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS);
-
- Private = AllocatePool (sizeof (WIN_NT_BLOCK_IO_PRIVATE));
- ASSERT (Private != NULL);
-
- EfiInitializeLock (&Private->Lock, TPL_NOTIFY);
-
- Private->WinNtThunk = WinNtIo->WinNtThunk;
-
- Private->Signature = WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE;
- Private->LastBlock = NumberOfBlocks - 1;
- Private->BlockSize = BlockSize;
-
- for (Index = 0; Filename[Index] != 0; Index++) {
- Private->Filename[Index] = Filename[Index];
- }
-
- Private->Filename[Index] = 0;
-
- Private->ReadMode = GENERIC_READ | (ReadOnly ? 0 : GENERIC_WRITE);
- Private->ShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
-
- Private->NumberOfBlocks = NumberOfBlocks;
- Private->DeviceType = DeviceType;
- Private->NtHandle = INVALID_HANDLE_VALUE;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gWinNtBlockIoComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- Private->Filename
- );
-
- BlockIo = &Private->BlockIo;
- BlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
- BlockIo->Media = &Private->Media;
- BlockIo->Media->BlockSize = Private->BlockSize;
- BlockIo->Media->LastBlock = Private->NumberOfBlocks - 1;
- BlockIo->Media->MediaId = 0;;
-
- BlockIo->Reset = WinNtBlockIoResetBlock;
- BlockIo->ReadBlocks = WinNtBlockIoReadBlocks;
- BlockIo->WriteBlocks = WinNtBlockIoWriteBlocks;
- BlockIo->FlushBlocks = WinNtBlockIoFlushBlocks;
-
- BlockIo->Media->ReadOnly = ReadOnly;
- BlockIo->Media->RemovableMedia = RemovableMedia;
- BlockIo->Media->LogicalPartition = FALSE;
- BlockIo->Media->MediaPresent = TRUE;
- BlockIo->Media->WriteCaching = FALSE;
-
- if (DeviceType == EfiWinNtVirtualDisks) {
- BlockIo->Media->IoAlign = 1;
-
- //
- // Create a file to use for a virtual disk even if it does not exist.
- //
- Private->OpenMode = OPEN_ALWAYS;
- } else if (DeviceType == EfiWinNtPhysicalDisks) {
- //
- // Physical disk and floppy devices require 4 byte alignment.
- //
- BlockIo->Media->IoAlign = 4;
-
- //
- // You can only open a physical device if it exists.
- //
- Private->OpenMode = OPEN_EXISTING;
- } else {
- ASSERT (FALSE);
- }
-
- Private->EfiHandle = EfiDeviceHandle;
- Status = WinNtBlockIoOpenDevice (Private);
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- FreePool (Private);
- }
-
- DEBUG ((EFI_D_INIT, "BlockDevice added: %s\n", Filename));
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-WinNtBlockIoOpenDevice (
- WIN_NT_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINT64 FileSize;
- UINT64 EndOfFile;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- BlockIo = &Private->BlockIo;
- EfiAcquireLock (&Private->Lock);
-
- //
- // If the device is already opened, close it
- //
- if (Private->NtHandle != INVALID_HANDLE_VALUE) {
- BlockIo->Reset (BlockIo, FALSE);
- }
-
- //
- // Open the device
- //
- Private->NtHandle = Private->WinNtThunk->CreateFile (
- Private->Filename,
- Private->ReadMode,
- Private->ShareMode,
- NULL,
- Private->OpenMode,
- 0,
- NULL
- );
-
- Status = Private->WinNtThunk->GetLastError ();
-
- if (Private->NtHandle == INVALID_HANDLE_VALUE) {
- DEBUG ((EFI_D_INFO, "PlOpenBlock: Could not open %s, %x\n", Private->Filename, Private->WinNtThunk->GetLastError ()));
- BlockIo->Media->MediaPresent = FALSE;
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (!BlockIo->Media->MediaPresent) {
- //
- // BugBug: try to emulate if a CD appears - notify drivers to check it out
- //
- BlockIo->Media->MediaPresent = TRUE;
- EfiReleaseLock (&Private->Lock);
- EfiAcquireLock (&Private->Lock);
- }
-
- //
- // get the size of the file
- //
- Status = SetFilePointer64 (Private, 0, &FileSize, FILE_END);
-
- if (EFI_ERROR (Status)) {
- FileSize = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
- if (Private->DeviceType == EfiWinNtVirtualDisks) {
- DEBUG ((EFI_D_ERROR, "PlOpenBlock: Could not get filesize of %s\n", Private->Filename));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- }
-
- if (Private->NumberOfBlocks == 0) {
- Private->NumberOfBlocks = DivU64x32 (FileSize, Private->BlockSize);
- }
-
- EndOfFile = MultU64x32 (Private->NumberOfBlocks, Private->BlockSize);
-
- if (FileSize != EndOfFile) {
- //
- // file is not the proper size, change it
- //
- DEBUG ((EFI_D_INIT, "PlOpenBlock: Initializing block device: %hs\n", Private->Filename));
-
- //
- // first set it to 0
- //
- SetFilePointer64 (Private, 0, NULL, FILE_BEGIN);
- Private->WinNtThunk->SetEndOfFile (Private->NtHandle);
-
- //
- // then set it to the needed file size (OS will zero fill it)
- //
- SetFilePointer64 (Private, EndOfFile, NULL, FILE_BEGIN);
- Private->WinNtThunk->SetEndOfFile (Private->NtHandle);
- }
-
- DEBUG ((EFI_D_INIT, "%HPlOpenBlock: opened %s%N\n", Private->Filename));
- Status = EFI_SUCCESS;
-
-Done:
- if (EFI_ERROR (Status)) {
- if (Private->NtHandle != INVALID_HANDLE_VALUE) {
- BlockIo->Reset (BlockIo, FALSE);
- }
- }
-
- EfiReleaseLock (&Private->Lock);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-WinNtBlockIoError (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_STATUS Status;
- BOOLEAN ReinstallBlockIoFlag;
-
- BlockIo = &Private->BlockIo;
-
- switch (Private->WinNtThunk->GetLastError ()) {
-
- case ERROR_NOT_READY:
- Status = EFI_NO_MEDIA;
- BlockIo->Media->ReadOnly = FALSE;
- BlockIo->Media->MediaPresent = FALSE;
- ReinstallBlockIoFlag = FALSE;
- break;
-
- case ERROR_WRONG_DISK:
- BlockIo->Media->ReadOnly = FALSE;
- BlockIo->Media->MediaPresent = TRUE;
- BlockIo->Media->MediaId += 1;
- ReinstallBlockIoFlag = TRUE;
- Status = EFI_MEDIA_CHANGED;
- break;
-
- case ERROR_WRITE_PROTECT:
- BlockIo->Media->ReadOnly = TRUE;
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_WRITE_PROTECTED;
- break;
-
- default:
- ReinstallBlockIoFlag = FALSE;
- Status = EFI_DEVICE_ERROR;
- break;
- }
-
- if (ReinstallBlockIoFlag) {
- BlockIo->Reset (BlockIo, FALSE);
-
- gBS->ReinstallProtocolInterface (
- Private->EfiHandle,
- &gEfiBlockIoProtocolGuid,
- BlockIo,
- BlockIo
- );
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-WinNtBlockIoReadWriteCommon (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer,
- IN CHAR8 *CallerName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
- CallerName - TODO: add argument description
-
-Returns:
-
- EFI_NO_MEDIA - TODO: Add description for return value
- EFI_MEDIA_CHANGED - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_BAD_BUFFER_SIZE - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINTN BlockSize;
- UINT64 LastBlock;
- INT64 DistanceToMove;
- UINT64 DistanceMoved;
-
- if (Private->NtHandle == INVALID_HANDLE_VALUE) {
- Status = WinNtBlockIoOpenDevice (Private);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- if (!Private->Media.MediaPresent) {
- DEBUG ((EFI_D_INIT, "%s: No Media\n", CallerName));
- return EFI_NO_MEDIA;
- }
-
- if (Private->Media.MediaId != MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- if ((UINT32) Buffer % Private->Media.IoAlign != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Verify buffer size
- //
- BlockSize = Private->BlockSize;
- if (BufferSize == 0) {
- DEBUG ((EFI_D_INIT, "%s: Zero length read\n", CallerName));
- return EFI_SUCCESS;
- }
-
- if ((BufferSize % BlockSize) != 0) {
- DEBUG ((EFI_D_INIT, "%s: Invalid read size\n", CallerName));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- LastBlock = Lba + (BufferSize / BlockSize) - 1;
- if (LastBlock > Private->LastBlock) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: Attempted to read off end of device\n"));
- return EFI_INVALID_PARAMETER;
- }
- //
- // Seek to End of File
- //
- DistanceToMove = MultU64x32 (Lba, BlockSize);
- Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, FILE_BEGIN);
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));
- return WinNtBlockIoError (Private);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Read BufferSize bytes from Lba into Buffer.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was read correctly from the device.
- EFI_DEVICE_ERROR - The device reported an error while performing the read.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHANGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The read request contains device addresses that are not
- valid for the device.
-
---*/
-{
- WIN_NT_BLOCK_IO_PRIVATE *Private;
- BOOL Flag;
- EFI_STATUS Status;
- DWORD BytesRead;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = WinNtBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "WinNtReadBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Flag = Private->WinNtThunk->ReadFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesRead, NULL);
- if (!Flag || (BytesRead != BufferSize)) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));
- Status = WinNtBlockIoError (Private);
- goto Done;
- }
-
- //
- // If we wrote then media is present.
- //
- This->Media->MediaPresent = TRUE;
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
- Routine Description:
- Write BufferSize bytes from Lba into Buffer.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was written correctly to the device.
- EFI_WRITE_PROTECTED - The device can not be written to.
- EFI_DEVICE_ERROR - The device reported an error while performing the write.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The write request contains a LBA that is not
- valid for the device.
-
---*/
-{
- WIN_NT_BLOCK_IO_PRIVATE *Private;
- UINTN BytesWritten;
- BOOL Flag;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Status = WinNtBlockIoReadWriteCommon (Private, MediaId, Lba, BufferSize, Buffer, "WinNtWriteBlocks");
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);
- if (!Flag || (BytesWritten != BufferSize)) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));
- Status = WinNtBlockIoError (Private);
- goto Done;
- }
-
- //
- // If the write succeeded, we are not write protected and media is present.
- //
- This->Media->MediaPresent = TRUE;
- This->Media->ReadOnly = FALSE;
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Flush the Block Device.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - All outstanding data was written to the device
- EFI_DEVICE_ERROR - The device reported an error while writting back the data
- EFI_NO_MEDIA - There is no media in the device.
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoResetBlock (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the Block Device.
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
- EFI_DEVICE_ERROR - The device is not functioning properly and could
- not be reset.
-
---*/
-{
- WIN_NT_BLOCK_IO_PRIVATE *Private;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->NtHandle != INVALID_HANDLE_VALUE) {
- Private->WinNtThunk->CloseHandle (Private->NtHandle);
- Private->NtHandle = INVALID_HANDLE_VALUE;
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-UINTN
-Atoi (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Convert a unicode string to a UINTN
-
-Arguments:
-
- String - Unicode string.
-
-Returns:
-
- UINTN of the number represented by String.
-
---*/
-{
- UINTN Number;
- CHAR16 *Str;
-
- //
- // skip preceeding white space
- //
- Str = String;
- while ((*Str) && (*Str == ' ')) {
- Str++;
- }
- //
- // Convert ot a Number
- //
- Number = 0;
- while (*Str != '\0') {
- if ((*Str >= '0') && (*Str <= '9')) {
- Number = (Number * 10) +*Str - '0';
- } else {
- break;
- }
-
- Str++;
- }
-
- return Number;
-}
-
-EFI_STATUS
-SetFilePointer64 (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private,
- IN INT64 DistanceToMove,
- OUT UINT64 *NewFilePointer,
- IN DWORD MoveMethod
- )
-/*++
-
-This function extends the capability of SetFilePointer to accept 64 bit parameters
-
---*/
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: Private - add argument and description to function comment
-// TODO: DistanceToMove - add argument and description to function comment
-// TODO: NewFilePointer - add argument and description to function comment
-// TODO: MoveMethod - add argument and description to function comment
-{
- EFI_STATUS Status;
- LARGE_INTEGER LargeInt;
- UINT32 ErrorCode;
-
- LargeInt.QuadPart = DistanceToMove;
- Status = EFI_SUCCESS;
-
- LargeInt.LowPart = Private->WinNtThunk->SetFilePointer (
- Private->NtHandle,
- LargeInt.LowPart,
- &LargeInt.HighPart,
- MoveMethod
- );
-
- if (LargeInt.LowPart == -1 &&
- (ErrorCode = Private->WinNtThunk->GetLastError ()) != NO_ERROR) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- if (NewFilePointer != NULL) {
- *NewFilePointer = LargeInt.QuadPart;
- }
-
- return Status;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h
deleted file mode 100644
index 59d4b54f64..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtBlockIo.h
-
-Abstract:
-
- Produce block IO abstractions for real devices 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*
- Developer Studio for them to work.
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#ifndef _WIN_NT_BLOCK_IO_H_
-#define _WIN_NT_BLOCK_IO_H_
-
-
-
-#define FILENAME_BUFFER_SIZE 80
-
-//
-// Language supported for driverconfiguration protocol
-//
-#define LANGUAGESUPPORTED "eng"
-
-typedef enum {
- EfiWinNtVirtualDisks,
- EfiWinNtPhysicalDisks,
- EifWinNtMaxTypeDisks
-} WIN_NT_RAW_DISK_DEVICE_TYPE;
-
-#define WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'b', 'k')
-typedef struct {
- UINTN Signature;
-
- EFI_LOCK Lock;
-
- CHAR16 Filename[FILENAME_BUFFER_SIZE];
- UINTN ReadMode;
- UINTN ShareMode;
- UINTN OpenMode;
-
- HANDLE NtHandle;
- WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType;
-
- UINT64 LastBlock;
- UINTN BlockSize;
- UINT64 NumberOfBlocks;
-
- EFI_HANDLE EfiHandle;
- EFI_BLOCK_IO_PROTOCOL BlockIo;
- EFI_BLOCK_IO_MEDIA Media;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
-} WIN_NT_BLOCK_IO_PRIVATE;
-
-#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, WIN_NT_BLOCK_IO_PRIVATE, BlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)
-
-#define LIST_BUFFER_SIZE 512
-
-//
-// Block I/O Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName;
-extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration;
-extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics;
-
-//
-// EFI Driver Binding Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtBlockIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Block IO protocol member functions
-//
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtBlockIoResetBlock (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Private Worker functions
-//
-STATIC
-EFI_STATUS
-WinNtBlockIoCreateMapping (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo,
- IN EFI_HANDLE EfiDeviceHandle,
- IN CHAR16 *Filename,
- IN BOOLEAN ReadOnly,
- IN BOOLEAN RemovableMedia,
- IN UINTN NumberOfBlocks,
- IN UINTN BlockSize,
- IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- WinNtIo - TODO: add argument description
- EfiDeviceHandle - TODO: add argument description
- Filename - TODO: add argument description
- ReadOnly - TODO: add argument description
- RemovableMedia - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
- BlockSize - TODO: add argument description
- DeviceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-WinNtBlockIoReadWriteCommon (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- IN VOID *Buffer,
- IN CHAR8 *CallerName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- MediaId - TODO: add argument description
- Lba - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
- CallerName - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-WinNtBlockIoError (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-WinNtBlockIoOpenDevice (
- WIN_NT_BLOCK_IO_PRIVATE *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-CHAR16 *
-GetNextElementPastTerminator (
- IN CHAR16 *EnvironmentVariable,
- IN CHAR16 Terminator
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- EnvironmentVariable - TODO: add argument description
- Terminator - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-
-
-EFI_STATUS
-SetFilePointer64 (
- IN WIN_NT_BLOCK_IO_PRIVATE *Private,
- IN INT64 DistanceToMove,
- OUT UINT64 *NewFilePointer,
- IN DWORD MoveMethod
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- DistanceToMove - TODO: add argument description
- NewFilePointer - TODO: add argument description
- MoveMethod - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINTN
-Atoi (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
deleted file mode 100644
index afbf8de6d4..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.msa
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtBlockIo</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>F479E147-A125-11d4-BCFC-0080C73C8881</GuidValue>
- <Version>1.0</Version>
- <Abstract>Block Io driver</Abstract>
- <Description>Produce block IO abstractions for real devices 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*
- Developer Studio for them to work.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtBlockIo</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtBlockIo.h</Filename>
- <Filename>WinNtBlockIo.c</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>DriverConfiguration.c</Filename>
- <Filename>DriverDiagnostics.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtVirtualDisksGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiWinNtPhysicalDisksGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtBlockIoDriverBinding</DriverBinding>
- <ComponentName>gWinNtBlockIoComponentName</ComponentName>
- <DriverDiag>gWinNtBlockIoDriverDiagnostics</DriverDiag>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c
deleted file mode 100644
index 81db085fd4..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ComponentName.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "Console.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtConsoleComponentName = {
- WinNtConsoleComponentNameGetDriverName,
- WinNtConsoleComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtConsoleDriverNameTable[] = {
- { "eng", L"Windows Text Console Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtConsoleComponentName.SupportedLanguages,
- mWinNtConsoleDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOut;
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtConsoleDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get out context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- &SimpleTextOut,
- gWinNtConsoleDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);
-
- return LookupUnicodeString (
- Language,
- gWinNtConsoleComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
deleted file mode 100644
index e32ffe80d5..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*++
-
-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:
-
- Console.c
-
-Abstract:
-
- Console based on Win32 APIs.
-
---*/
-
-#include "Console.h"
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtConsoleDriverBinding = {
- WinNtConsoleDriverBindingSupported,
- WinNtConsoleDriverBindingStart,
- WinNtConsoleDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure that the WinNt Thunk Protocol is valid
- //
- Status = EFI_UNSUPPORTED;
- if (WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtConsoleGuid)) {
- Status = EFI_SUCCESS;
- }
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // Grab the IO abstraction we need to get any work done
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Private = AllocatePool (sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA));
- if (Private == NULL) {
- goto Done;
- }
-
- ZeroMem (Private, sizeof (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA));
-
- Private->Signature = WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->WinNtIo = WinNtIo;
- Private->WinNtThunk = WinNtIo->WinNtThunk;
-
- WinNtSimpleTextOutOpenWindow (Private);
- WinNtSimpleTextInAttachToWindow (Private);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOut,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- return Status;
- }
-
-Done:
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- if (Private != NULL) {
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- if (Private->NtOutHandle != NULL) {
- Private->WinNtThunk->CloseHandle (Private->NtOutHandle);
- }
-
- if (Private->SimpleTextIn.WaitForKey != NULL) {
- gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- }
-
- FreePool (Private);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtConsoleDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_UNSUPPORTED - TODO: Add description for return value
-
---*/
-{
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOut;
- EFI_STATUS Status;
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- //
- // Kick people off our interface???
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- &SimpleTextOut,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (SimpleTextOut);
-
- ASSERT (Private->Handle == Handle);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOut,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
-
- //
- // Shut down our device
- //
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);
- ASSERT_EFI_ERROR (Status);
-
- Private->WinNtThunk->CloseHandle (Private->NtOutHandle);
- //
- // DO NOT close Private->NtInHandle. It points to StdIn and not
- // the Private->NtOutHandle is StdIn and should not be closed!
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
-
- return Status;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h
deleted file mode 100644
index 1c8a26bddc..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/Console.h
+++ /dev/null
@@ -1,512 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- Console.h
-
-Abstract:
-
- 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
- protocol
-
---*/
-
-#ifndef _CONSOLE_H_
-#define _CONSOLE_H_
-
-
-
-#define WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE \
- EFI_SIGNATURE_32('N','T','s','c')
-
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
-
- EFI_SIMPLE_TEXT_OUT_PROTOCOL SimpleTextOut;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutMode;
-
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
- //
- // SimpleTextOut Private Data including Win32 types.
- //
- HANDLE NtOutHandle;
- HANDLE NtInHandle;
-
- COORD MaxScreenSize;
- COORD Possition;
- WORD Attribute;
- BOOLEAN CursorEnable;
-
- EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleTextIn;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} WIN_NT_SIMPLE_TEXT_PRIVATE_DATA;
-
-#define WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextOut, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)
-
-#define WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA, SimpleTextIn, WIN_NT_SIMPLE_TEXT_PRIVATE_DATA_SIGNATURE)
-
-//
-// Console Globale Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtConsoleDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtConsoleComponentName;
-
-typedef struct {
- UINTN ColumnsX;
- UINTN RowsY;
-} WIN_NT_SIMPLE_TEXT_OUT_MODE;
-
-//
-// Simple Text Out protocol member functions
-//
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
- Columns - TODO: add argument description
- Rows - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Attribute - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Column - TODO: add argument description
- Row - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Simple Text Out constructor and destructor.
-//
-EFI_STATUS
-WinNtSimpleTextOutOpenWindow (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-WinNtSimpleTextOutCloseWindow (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Simple Text In protocol member functions.
-//
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-VOID
-EFIAPI
-WinNtSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Simple Text In constructor
-//
-EFI_STATUS
-WinNtSimpleTextInAttachToWindow (
- IN WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Main Entry Point
-//
-EFI_STATUS
-EFIAPI
-InitializeWinNtConsole (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-AppendDevicePathInstanceToVar (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- VariableName - TODO: add argument description
- DevicePathInstance - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
deleted file mode 100644
index eaee537baf..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleIn.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*++
-
-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:
-
- ConsoleIn.c
-
-Abstract:
-
- 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
- protocol
-
---*/
-
-#include "Console.h"
-
-//
-// Private worker functions
-//
-STATIC
-EFI_STATUS
-WinNtSimpleTextInCheckKey (
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- );
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-WinNtConvertInputRecordToEfiKey (
- IN INPUT_RECORD *InputRecord,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- InputRecord - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- //
- // Make sure InputRecord is an event that represents a keypress
- //
- if (InputRecord->EventType == KEY_EVENT) {
- if (!InputRecord->Event.KeyEvent.bKeyDown) {
- return EFI_NOT_READY;
- }
- } else {
- return EFI_NOT_READY;
- }
-
- //
- // Check to see if we should return a scan code in place of Unicode character.
- //
- Key->ScanCode = 0;
- Key->UnicodeChar = 0;
- if ((InputRecord->Event.KeyEvent.dwControlKeyState & (NUMLOCK_ON | ENHANCED_KEY)) != NUMLOCK_ON) {
- //
- // Only check these scan codes if num lock is off.
- //
- switch (InputRecord->Event.KeyEvent.wVirtualScanCode) {
- case 0x48: Key->ScanCode = SCAN_UP; break;
- case 0x50: Key->ScanCode = SCAN_DOWN; break;
- case 0x4d: Key->ScanCode = SCAN_RIGHT; break;
- case 0x4b: Key->ScanCode = SCAN_LEFT; break;
- case 0x47: Key->ScanCode = SCAN_HOME; break;
- case 0x4F: Key->ScanCode = SCAN_END; break;
- case 0x52: Key->ScanCode = SCAN_INSERT; break;
- case 0x53: Key->ScanCode = SCAN_DELETE; break;
- case 0x49: Key->ScanCode = SCAN_PAGE_UP; break;
- case 0x51: Key->ScanCode = SCAN_PAGE_DOWN; break;
- }
- }
-
- switch (InputRecord->Event.KeyEvent.wVirtualScanCode) {
- case 0x3b: Key->ScanCode = SCAN_F1; break;
- case 0x3c: Key->ScanCode = SCAN_F2; break;
- case 0x3d: Key->ScanCode = SCAN_F3; break;
- case 0x3e: Key->ScanCode = SCAN_F4; break;
- case 0x3f: Key->ScanCode = SCAN_F5; break;
- case 0x40: Key->ScanCode = SCAN_F6; break;
- case 0x41: Key->ScanCode = SCAN_F7; break;
- case 0x42: Key->ScanCode = SCAN_F8; break;
- case 0x43: Key->ScanCode = SCAN_F9; break;
- case 0x44: Key->ScanCode = SCAN_F10; break;
- case 0x01: Key->ScanCode = SCAN_ESC; break;
- }
-
- //
- // If there's a scan code pass it, and don't pass the char code
- //
- if (Key->ScanCode == 0) {
- Key->UnicodeChar = InputRecord->Event.KeyEvent.uChar.UnicodeChar;
- if (Key->UnicodeChar == 0) {
- return EFI_NOT_READY;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
- INPUT_RECORD InputRecord;
- DWORD NtEventCount;
-
- Private = WIN_NT_SIMPLE_TEXT_IN_PRIVATE_DATA_FROM_THIS (This);
-
- Status = WinNtSimpleTextInCheckKey (Private);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- do {
-
- if (!Private->WinNtThunk->ReadConsoleInput (Private->NtInHandle, &InputRecord, 1, &NtEventCount)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (NtEventCount == 0) {
- return EFI_NOT_READY;
- }
-
- //
- // Convert the Input Record to an EFI Keystroke.
- //
- Status = WinNtConvertInputRecordToEfiKey (&InputRecord, Key);
- } while (EFI_ERROR (Status));
-
- return Status;
-}
-
-STATIC
-VOID
-EFIAPI
-WinNtSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
- EFI_STATUS Status;
-
- Private = (WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *) Context;
- Status = WinNtSimpleTextInCheckKey (Private);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (Event);
- }
-}
-
-STATIC
-EFI_STATUS
-WinNtSimpleTextInCheckKey (
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- INPUT_RECORD *InputRecord;
- DWORD NtEventCount;
- DWORD ActualNtEventCount;
- EFI_STATUS Status;
- BOOLEAN Success;
- UINTN Index;
- EFI_INPUT_KEY Key;
-
- InputRecord = NULL;
- NtEventCount = 0;
- Private->WinNtThunk->GetNumberOfConsoleInputEvents (Private->NtInHandle, &NtEventCount);
- if (NtEventCount == 0) {
- Status = EFI_NOT_READY;
- goto Done;
- }
-
- InputRecord = AllocatePool (sizeof (INPUT_RECORD) * NtEventCount);
- if (InputRecord == NULL) {
- Status = EFI_NOT_READY;
- goto Done;
- }
-
- Success = (BOOLEAN) Private->WinNtThunk->PeekConsoleInput (
- Private->NtInHandle,
- InputRecord,
- NtEventCount,
- &ActualNtEventCount
- );
- if (!Success) {
- Status = EFI_NOT_READY;
- goto Done;
- }
-
- Status = EFI_NOT_READY;
- for (Index = 0; Index < (UINTN) ActualNtEventCount; Index++) {
- //
- // Convert the Input Record to an EFI Keystroke.
- //
- Status = WinNtConvertInputRecordToEfiKey (&InputRecord[Index], &Key);
- if (!EFI_ERROR (Status)) {
- Status = EFI_SUCCESS;
- goto Done;
- }
- }
-
-Done:
- if (InputRecord != NULL) {
- FreePool (InputRecord);
- }
-
- return Status;
-}
-
-EFI_STATUS
-WinNtSimpleTextInAttachToWindow (
- IN WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- Private->NtInHandle = Private->WinNtThunk->GetStdHandle (STD_INPUT_HANDLE);
-
- Private->SimpleTextIn.Reset = WinNtSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = WinNtSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- WinNtSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c
deleted file mode 100644
index cab3768b1c..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/ConsoleOut.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ConsoleOut.c
-
-Abstract:
-
- Console based on Win32 APIs.
-
- This file creates an Win32 window and attaches a SimpleTextOut protocol.
-
---*/
-
-#include "Console.h"
-//
-// Private worker functions.
-//
-
-STATIC
-VOID
-WinNtSimpleTextOutScrollScreen (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console
- );
-
-STATIC
-VOID
-WinNtSimpleTextOutPutChar (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console,
- IN CHAR16 Char
- );
-
-//
-// Modeule Global for Simple Text Out Mode.
-//
-#define MAX_SIMPLE_TEXT_OUT_MODE \
- (sizeof(mWinNtSimpleTextOutSupportedModes)/sizeof(WIN_NT_SIMPLE_TEXT_OUT_MODE))
-
-STATIC WIN_NT_SIMPLE_TEXT_OUT_MODE mWinNtSimpleTextOutSupportedModes[] = {
- { 80, 25 },
- { 80, 50 },
- { 80, 43 },
- { 100, 100 },
- { 100, 999 }
-};
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- WinNtSimpleTextOutSetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
-
- WinNtSimpleTextOutSetMode (This, 0);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
- CHAR16 *Str;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- for (Str = String; *Str != '\0'; Str++) {
- switch (*Str) {
- case '\n':
- if (Private->Possition.Y == (Private->MaxScreenSize.Y - 1)) {
- WinNtSimpleTextOutScrollScreen (Private);
- }
-
- if (Private->Possition.Y < (Private->MaxScreenSize.Y - 1)) {
- Private->Possition.Y++;
- This->Mode->CursorRow++;
- }
- break;
-
- case '\r':
- Private->Possition.X = 0;
- This->Mode->CursorColumn = 0;
- break;
-
- case '\b':
- if (Private->Possition.X > 0) {
- Private->Possition.X--;
- This->Mode->CursorColumn--;
- }
- break;
-
- default:
- WinNtSimpleTextOutPutChar (Private, *Str);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-WinNtSimpleTextOutPutChar (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console,
- IN CHAR16 Char
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
- Char - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- SMALL_RECT Region;
- COORD StrCoordinate;
- COORD StrSize;
- CHAR_INFO CharInfo;
- BOOL Flag;
-
- CharInfo.Char.UnicodeChar = Char;
- CharInfo.Attributes = Console->Attribute;
-
- StrSize.X = 1;
- StrSize.Y = 1;
- StrCoordinate.X = 0;
- StrCoordinate.Y = 0;
-
- Region.Left = (INT16) Console->Possition.X;
- Region.Top = (INT16) Console->Possition.Y;
- Region.Right = (INT16) (Console->Possition.X + 1);
- Region.Bottom = (INT16) Console->Possition.Y;
-
- Console->WinNtThunk->WriteConsoleOutput (
- Console->NtOutHandle,
- &CharInfo,
- StrSize,
- StrCoordinate,
- &Region
- );
-
- if (Console->Possition.X >= (Console->MaxScreenSize.X - 1)) {
- //
- // If you print off the end wrap around
- //
- Console->SimpleTextOut.OutputString (&Console->SimpleTextOut, L"\n\r");
- } else {
- Console->Possition.X++;
- Console->SimpleTextOut.Mode->CursorColumn++;
- }
-
- Flag = Console->WinNtThunk->SetConsoleCursorPosition (Console->NtOutHandle, Console->Possition);
-}
-
-STATIC
-VOID
-WinNtSimpleTextOutScrollScreen (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- SMALL_RECT Scroll;
- CHAR_INFO CharInfo;
- COORD Origin;
-
- CharInfo.Char.UnicodeChar = ' ';
- CharInfo.Attributes = Console->Attribute;
-
- Origin.X = 0;
- Origin.Y = 0;
-
- Scroll.Top = 1;
- Scroll.Left = 0;
- Scroll.Right = (INT16) Console->MaxScreenSize.X;
- Scroll.Bottom = (INT16) Console->MaxScreenSize.Y;
-
- Console->WinNtThunk->ScrollConsoleScreenBuffer (
- Console->NtOutHandle,
- &Scroll,
- NULL,
- Origin,
- &CharInfo
- );
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- String - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // BugBug: The correct answer would be a function of what code pages
- // are currently loaded? For now we will just return success.
- //
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
- Columns - TODO: add argument description
- Rows - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Columns = mWinNtSimpleTextOutSupportedModes[ModeNumber].ColumnsX;
- *Rows = mWinNtSimpleTextOutSupportedModes[ModeNumber].RowsY;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ModeNumber - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber > MAX_SIMPLE_TEXT_OUT_MODE) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private->MaxScreenSize.X = (WORD) mWinNtSimpleTextOutSupportedModes[ModeNumber].ColumnsX;
- Private->MaxScreenSize.Y = (WORD) mWinNtSimpleTextOutSupportedModes[ModeNumber].RowsY;
-
- Private->WinNtThunk->SetConsoleScreenBufferSize (Private->NtOutHandle, Private->MaxScreenSize);
- Private->WinNtThunk->SetConsoleActiveScreenBuffer (Private->NtOutHandle);
-
- This->Mode->Mode = (INT32) ModeNumber;
-
- This->EnableCursor (This, TRUE);
- This->ClearScreen (This);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Attribute - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Attribute = (WORD) Attribute;
- This->Mode->Attribute = (INT32) Attribute;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
- DWORD ConsoleWindow;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- This->SetCursorPosition (This, 0, 0);
-
- Private->WinNtThunk->FillConsoleOutputCharacter (
- Private->NtOutHandle,
- ' ',
- Private->MaxScreenSize.X * Private->MaxScreenSize.Y,
- Private->Possition,
- &ConsoleWindow
- );
- Private->WinNtThunk->FillConsoleOutputAttribute (
- Private->NtOutHandle,
- Private->Attribute,
- Private->MaxScreenSize.X * Private->MaxScreenSize.Y,
- Private->Possition,
- &ConsoleWindow
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Column - TODO: add argument description
- Row - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
-
- Private->Possition.X = (WORD) Column;
- This->Mode->CursorColumn = (INT32) Column;
-
- Private->Possition.Y = (WORD) Row;
- This->Mode->CursorRow = (INT32) Row;
- Private->WinNtThunk->SetConsoleCursorPosition (Private->NtOutHandle, Private->Possition);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSimpleTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private;
- CONSOLE_CURSOR_INFO Info;
-
- Private = WIN_NT_SIMPLE_TEXT_OUT_PRIVATE_DATA_FROM_THIS (This);
- Private->CursorEnable = Enable;
- This->Mode->CursorVisible = Enable;
-
- Private->WinNtThunk->GetConsoleCursorInfo (Private->NtOutHandle, &Info);
- Info.bVisible = Enable;
- Private->WinNtThunk->SetConsoleCursorInfo (Private->NtOutHandle, &Info);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WinNtSimpleTextOutOpenWindow (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOut;
- CHAR16 *WindowName;
-
- WindowName = Private->WinNtIo->EnvString;
- Private->Attribute = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
- if (*WindowName == '?') {
- Private->Attribute = BACKGROUND_RED | FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN;
- WindowName = L"EFI Emulator Error Console";
- }
-
- AddUnicodeString (
- "eng",
- gWinNtConsoleComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WindowName
- );
-
- //
- // Fill in protocol member functions
- //
- SimpleTextOut = &Private->SimpleTextOut;
- SimpleTextOut->Reset = WinNtSimpleTextOutReset;
- SimpleTextOut->OutputString = WinNtSimpleTextOutOutputString;
- SimpleTextOut->TestString = WinNtSimpleTextOutTestString;
- SimpleTextOut->QueryMode = WinNtSimpleTextOutQueryMode;
- SimpleTextOut->SetMode = WinNtSimpleTextOutSetMode;
- SimpleTextOut->SetAttribute = WinNtSimpleTextOutSetAttribute;
- SimpleTextOut->ClearScreen = WinNtSimpleTextOutClearScreen;
- SimpleTextOut->SetCursorPosition = WinNtSimpleTextOutSetCursorPosition;
- SimpleTextOut->EnableCursor = WinNtSimpleTextOutEnableCursor;
-
- //
- // Initialize SimpleTextOut protocol mode structure
- //
- SimpleTextOut->Mode = &Private->SimpleTextOutMode;
- SimpleTextOut->Mode->MaxMode = MAX_SIMPLE_TEXT_OUT_MODE;
- SimpleTextOut->Mode->Attribute = (INT32) Private->Attribute;
-
- //
- // Open the window an initialize it!
- //
- Private->NtOutHandle = Private->WinNtThunk->CreateConsoleScreenBuffer (
- GENERIC_WRITE | GENERIC_READ,
- FILE_SHARE_WRITE | FILE_SHARE_READ,
- NULL,
- CONSOLE_TEXTMODE_BUFFER,
- NULL
- );
- Private->WinNtThunk->SetConsoleTitle (WindowName);
-
- return SimpleTextOut->SetMode (SimpleTextOut, 0);
-}
-
-EFI_STATUS
-WinNtSimpleTextOutCloseWindow (
- IN OUT WIN_NT_SIMPLE_TEXT_PRIVATE_DATA *Console
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Console - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Console->WinNtThunk->CloseHandle (Console->NtOutHandle);
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
deleted file mode 100644
index 595213eacf..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Console/WinNtConsole.msa
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtConsole</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>263631d7-5836-4b74-be48-ee22e92ce5d3</GuidValue>
- <Version>1.0</Version>
- <Abstract>Console Dxe driver</Abstract>
- <Description>Simulate console with WinAPI</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtConsole</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Console.h</Filename>
- <Filename>Console.c</Filename>
- <Filename>ConsoleIn.c</Filename>
- <Filename>ConsoleOut.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtConsoleGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtConsoleDriverBinding</DriverBinding>
- <ComponentName>gWinNtConsoleComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
deleted file mode 100644
index 8bdf1130a1..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/** @file
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
-
-**/
-
-#include "WinNtGop.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName = {
- WinNtGopComponentNameGetDriverName,
- WinNtGopComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtGopDriverNameTable[] = {
- { "eng", L"Windows GOP Driver" },
- { NULL , NULL }
-};
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL
- instance.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the driver
- name that that the caller is requesting, and it
- must match one of the languages specified in
- SupportedLanguages. The number of languages
- supported by a driver is up to the driver writer.
- @param DriverName A pointer to the Unicode string to return. This
- Unicode string is the name of the driver specified
- by This in the language specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by
- This and the language specified by Language was
- returned in DriverName.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString (
- Language,
- gWinNtGopComponentName.SupportedLanguages,
- mWinNtGopDriverNameTable,
- DriverName
- );
-}
-
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL
- instance.
- @param ControllerHandle The handle of a controller that the driver
- specified by This is managing. This handle
- specifies the controller whose name is to be
- returned.
- @param ChildHandle The handle of the child controller to retrieve the
- name of. This is an optional parameter that may
- be NULL. It will be NULL for device drivers. It
- will also be NULL for a bus drivers that wish to
- retrieve the name of the bus controller. It will
- not be NULL for a bus driver that wishes to
- retrieve the name of a child controller.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the
- controller name that that the caller is
- requesting, and it must match one of the languages
- specified in SupportedLanguages. The number of
- languages supported by a driver is up to the
- driver writer.
- @param ControllerName A pointer to the Unicode string to return. This
- Unicode string is the name of the controller
- specified by ControllerHandle and ChildHandle in
- the language specified by Language from the point
- of view of the driver specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in
- the language specified by Language for the driver
- specified by This was returned in DriverName.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- GOP_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtGopDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiGraphicsOutputProtocolGuid,
- &GraphicsOutput,
- gWinNtGopDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
- return LookupUnicodeString (
- Language,
- gWinNtGopComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h
deleted file mode 100644
index b1341cb864..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/** @file
-
-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.
-
-Module Name:
-
- WinNtGop.h
-
-Abstract:
-
- Private data for the Gop driver that is bound to the WinNt Thunk protocol
-
-
-**/
-
-#ifndef _WIN_NT_GOP_H_
-#define _WIN_NT_GOP_H_
-
-//@MT:#include "EfiWinNT.h"
-//@MT:#include "Tiano.h"
-//@MT:#include "EfiDriverLib.h"
-
-//
-// Driver Consumed Protocols
-//
-//@MT:#include EFI_PROTOCOL_DEFINITION (DevicePath)
-//@MT:#include EFI_PROTOCOL_DEFINITION (WinNtIo)
-
-//
-// Driver Produced Protocols
-//
-//@MT:#include EFI_PROTOCOL_DEFINITION (DriverBinding)
-//@MT:#include EFI_PROTOCOL_DEFINITION (ComponentName)
-//@MT:#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
-//@MT:#include "LinkedList.h"
-
-#define MAX_Q 256
-
-typedef struct {
- UINTN Front;
- UINTN Rear;
- UINTN Count;
- EFI_INPUT_KEY Q[MAX_Q];
-} GOP_QUEUE_FIXED;
-
-#define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
-
-#define GOP_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
-
-#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
-
-typedef struct {
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
-} GOP_MODE_DATA;
-
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
- EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleTextIn;
-
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- //
- // GOP Private Data for QueryMode ()
- //
- GOP_MODE_DATA *ModeData;
-
- //
- // GOP Private Data knowing when to start hardware
- //
- BOOLEAN HardwareNeedsStarting;
-
- CHAR16 *WindowName;
- CHAR16 Buffer[160];
-
- HANDLE ThreadInited; // Semaphore
- HANDLE ThreadHandle; // Thread
- DWORD ThreadId;
-
- HWND WindowHandle;
- WNDCLASSEX WindowsClass;
-
- //
- // This screen is used to redraw the scree when windows events happen. It's
- // updated in the main thread and displayed in the windows thread.
- //
- BITMAPV4HEADER *VirtualScreenInfo;
- RGBQUAD *VirtualScreen;
-
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
-
- //
- // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
- // thread removes.
- //
- CRITICAL_SECTION QCriticalSection;
- GOP_QUEUE_FIXED Queue;
-
-} GOP_PRIVATE_DATA;
-
-#define GOP_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
-
-#define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
- CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName;
-
-//
-// Gop Hardware abstraction internal worker functions
-//
-
-/**
- TODO: Add function description
-
- @param WinNtIo TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopSupported (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopConstructor (
- IN GOP_PRIVATE_DATA *Private
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopDestructor (
- IN GOP_PRIVATE_DATA *Private
- )
-;
-
-//
-// EFI 1.1 driver model prototypes for Win NT GOP
-//
-
-
-/**
- TODO: Add function description
-
- @param ImageHandle TODO: add argument description
- @param SystemTable TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Handle TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Handle TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Handle TODO: add argument description
- @param NumberOfChildren TODO: add argument description
- @param ChildHandleBuffer TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Key TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-GopPrivateAddQ (
- IN GOP_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopDestroySimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param String TODO: add argument description
-
- @return TODO: add return values
-
-**/
-UINTN
-Atoi (
- IN CHAR16 *String
- )
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
deleted file mode 100644
index 3874252791..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtGop</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>29b3c4c6-e5aa-49e4-8ce0-2772f782ddc2</GuidValue>
- <Version>1.0</Version>
- <Abstract>Gop Driver</Abstract>
- <Description>GOP is short hand for UEFI Graphics Output protocol.
- This file is a verision of GopIo 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.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtGop</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtGopScreen.c</Filename>
- <Filename>WinNtGopInput.c</Filename>
- <Filename>WinNtGop.h</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>WinNtGopDriver.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Events>
- <CreateEvents>
- <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="SOMETIMES_CONSUMED">
- <EventType>EVENT_GROUP_GUID</EventType>
- </EventTypes>
- </CreateEvents>
- </Events>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtGopGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtGopDriverBinding</DriverBinding>
- <ComponentName>gWinNtGopComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
deleted file mode 100644
index bf2abc4067..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/** @file
-
-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:
-
- WinNtGopDriver.c
-
-Abstract:
-
- This file implements the UEFI Device Driver model requirements for GOP
-
- GOP is short hand for Graphics Output Protocol.
-
-
-**/
-
-#include "WinNtGop.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = {
- WinNtGopDriverBindingSupported,
- WinNtGopDriverBindingStart,
- WinNtGopDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-/**
-
-
- @return None
-
-**/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = WinNtGopSupported (WinNtIo);
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-
-/**
-
-
- @return None
-
-**/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Allocate Private context data for SGO inteface.
- //
- Private = NULL;
- Private = AllocatePool (sizeof (GOP_PRIVATE_DATA));
- if (Private == NULL) {
- goto Done;
- }
- //
- // Set up context record
- //
- Private->Signature = GOP_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->WinNtThunk = WinNtIo->WinNtThunk;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gWinNtGopComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WinNtIo->EnvString
- );
-
- Private->WindowName = WinNtIo->EnvString;
-
- Status = WinNtGopConstructor (Private);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Publish the Gop interface to the world
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiGraphicsOutputProtocolGuid,
- &Private->GraphicsOutput,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- if (Private != NULL) {
- //
- // On Error Free back private data
- //
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
-
- FreePool (Private);
- }
- }
-
- return Status;
-}
-
-
-/**
-
-
- @return None
-
-**/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_NOT_STARTED - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiGraphicsOutputProtocolGuid,
- &GraphicsOutput,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // If the GOP interface does not exist the driver is not started
- //
- return EFI_NOT_STARTED;
- }
-
- //
- // Get our private context information
- //
- Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
-
- //
- // Remove the SGO interface from the system
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->Handle,
- &gEfiGraphicsOutputProtocolGuid,
- &Private->GraphicsOutput,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Shutdown the hardware
- //
- Status = WinNtGopDestructor (Private);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
-
- }
-
- return Status;
-}
-
-
-/**
- Convert a unicode string to a UINTN
-
- @param String Unicode string.
-
- @return UINTN of the number represented by String.
-
-**/
-UINTN
-Atoi (
- CHAR16 *String
- )
-{
- UINTN Number;
- CHAR16 *Str;
-
- //
- // skip preceeding white space
- //
- Str = String;
- while ((*Str) && (*Str == ' ' || *Str == '"')) {
- Str++;
- }
-
- //
- // Convert ot a Number
- //
- Number = 0;
- while (*Str != '\0') {
- if ((*Str >= '0') && (*Str <= '9')) {
- Number = (Number * 10) +*Str - '0';
- } else {
- break;
- }
-
- Str++;
- }
-
- return Number;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c
deleted file mode 100644
index 385e32f4a2..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/** @file
-
-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.
-
-Module Name:
-
- WinNtGopInput.c
-
-Abstract:
-
- This file produces the Simple Text In for an Gop window.
-
- This stuff is linked at the hip to the Window, since the window
- processing is done in a thread kicked off in WinNtGopImplementation.c
-
- Since the window information is processed in an other thread we need
- a keyboard Queue to pass data about. The Simple Text In code just
- takes data off the Queue. The WinProc message loop takes keyboard input
- and places it in the Queue.
-
-
-**/
-
-#include "WinNtGop.h"
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateCreateQ (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- Private->WinNtThunk->InitializeCriticalSection (&Private->QCriticalSection);
-
- Private->Queue.Front = 0;
- Private->Queue.Rear = MAX_Q - 1;
- Private->Queue.Count = 0;
- return EFI_SUCCESS;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateDestroyQ (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- Private->Queue.Count = 0;
- Private->WinNtThunk->DeleteCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Key TODO: add argument description
-
- @retval EFI_NOT_READY TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateAddQ (
- IN GOP_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-{
- Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
- if (Private->Queue.Count == MAX_Q) {
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_NOT_READY;
- }
-
- Private->Queue.Rear = (Private->Queue.Rear + 1) % MAX_Q;
- Private->Queue.Q[Private->Queue.Rear] = Key;
- Private->Queue.Count++;
-
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Key TODO: add argument description
-
- @retval EFI_NOT_READY TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateDeleteQ (
- IN GOP_PRIVATE_DATA *Private,
- OUT EFI_INPUT_KEY *Key
- )
-{
- Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
- if (Private->Queue.Count == 0) {
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_NOT_READY;
- }
-
- *Key = Private->Queue.Q[Private->Queue.Front];
- Private->Queue.Front = (Private->Queue.Front + 1) % MAX_Q;
- Private->Queue.Count--;
-
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @retval EFI_NOT_READY TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-GopPrivateCheckQ (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- if (Private->Queue.Count == 0) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Simple Text In implementation.
-//
-
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param ExtendedVerification TODO: add argument description
-
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_INPUT_KEY Key;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (GopPrivateDeleteQ (Private, &Key) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Key TODO: add argument description
-
- @return TODO: add return values
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtGopSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = GopPrivateCheckQ (Private);
- if (!EFI_ERROR (Status)) {
- //
- // If a Key press exists try and read it.
- //
- Status = GopPrivateDeleteQ (Private, Key);
- }
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-
-/**
- TODO: Add function description
-
- @param Event TODO: add argument description
- @param Context TODO: add argument description
-
- @return TODO: add return values
-
-**/
-STATIC
-VOID
-EFIAPI
-WinNtGopSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (GOP_PRIVATE_DATA *) Context;
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = GopPrivateCheckQ (Private);
- if (!EFI_ERROR (Status)) {
- //
- // If a there is a key in the queue signal our event.
- //
- gBS->SignalEvent (Event);
- } else {
- //
- // We need to sleep or NT will schedule this thread with such high
- // priority that WinProc thread will never run and we will not see
- // keyboard input. This Sleep makes the syste run 10x faster, so don't
- // remove it.
- //
- Private->WinNtThunk->Sleep (1);
- }
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopInitializeSimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- EFI_STATUS Status;
-
- GopPrivateCreateQ (Private);
-
- //
- // Initialize Simple Text In protoocol
- //
- Private->SimpleTextIn.Reset = WinNtGopSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = WinNtGopSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- WinNtGopSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
-
- return Status;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-WinNtGopDestroySimpleTextInForWindow (
- IN GOP_PRIVATE_DATA *Private
- )
-{
- GopPrivateDestroyQ (Private);
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
deleted file mode 100644
index 1923c34972..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
+++ /dev/null
@@ -1,996 +0,0 @@
-/** @file
-
-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:
-
- WinNtGopScreen.c
-
-Abstract:
-
- This file produces the graphics abstration of GOP. It is called by
- WinNtGopDriver.c file which deals with the EFI 1.1 driver model.
- This file just does graphics.
-
-
-**/
-
-#include "WinNtGop.h"
-
-EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
-DWORD mTlsIndex = TLS_OUT_OF_INDEXES;
-DWORD mTlsIndexUseCount = 0; // lets us know when we can free mTlsIndex.
-static EFI_EVENT mGopScreenExitBootServicesEvent;
-GOP_MODE_DATA mGopModeData[] = {
- {800, 600, 0, 0},
- {640, 480, 0, 0},
- {720, 400, 0, 0},
- {1024, 768, 0, 0},
- {1280, 1024, 0, 0}
- };
-
-EFI_STATUS
-WinNtGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- );
-
-STATIC
-VOID
-EFIAPI
-KillNtGopThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// GOP Protocol Member Functions
-//
-
-
-/**
- Graphics Output protocol interface to get video mode
-
- @param This Protocol instance pointer.
- @param ModeNumber The mode number to return information on.
- @param Info Caller allocated buffer that returns information
- about ModeNumber.
- @param SizeOfInfo A pointer to the size, in bytes, of the Info
- buffer.
-
- @retval EFI_SUCCESS Mode information returned.
- @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
- @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the
- video mode.
- @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
- @retval EFI_INVALID_PARAMETER One of the input args was NULL.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopQuerytMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
- )
-{
- GOP_PRIVATE_DATA *Private;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
- if (*Info == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-
- (*Info)->Version = 0;
- (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;
- (*Info)->VerticalResolution = Private->ModeData[ModeNumber].VerticalResolution;
- (*Info)->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
- (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Graphics Output protocol interface to set video mode
-
- @param This Protocol instance pointer.
- @param ModeNumber The mode number to be set.
-
- @retval EFI_SUCCESS Graphics mode was changed.
- @retval EFI_DEVICE_ERROR The device had an error and could not complete the
- request.
- @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
-
-**/
-EFI_STATUS
-EFIAPI
-WinNtGopSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
- IN UINT32 ModeNumber
- )
-{
- EFI_STATUS Status;
- GOP_PRIVATE_DATA *Private;
- GOP_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewFillLine;
- RECT Rect;
- UINTN Size;
- UINTN Width;
- UINTN Height;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if (ModeNumber >= This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
-
- if (ModeNumber == This->Mode->Mode) {
- return EFI_SUCCESS;
- }
-
- ModeData = &Private->ModeData[ModeNumber];
- This->Mode->Mode = ModeNumber;
- Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
- Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution;
- Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution;
-
- if (Private->HardwareNeedsStarting) {
- Status = WinNtGopStartWindow (
- Private,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- ModeData->ColorDepth,
- ModeData->RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareNeedsStarting = FALSE;
- } else {
- //
- // Change the resolution and resize of the window
- //
-
- //
- // Free the old buffer. We do not save the content of the old buffer since the
- // screen is to be cleared anyway. Clearing the screen is required by the EFI spec.
- // See UEFI spec -EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode()
- //
- Private->WinNtThunk->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
- //
- // Allocate DIB frame buffer directly from NT for performance enhancement
- // This buffer is the virtual screen/frame buffer. This buffer is not the
- // same a a frame buffer. The first row of this buffer will be the bottom
- // line of the image. This is an artifact of the way we draw to the screen.
- //
- Size = ModeData->HorizontalResolution * ModeData->VerticalResolution * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
- Private->WinNtThunk->GetProcessHeap (),
- HEAP_ZERO_MEMORY,
- Size
- );
-
- //
- // Update the virtual screen info data structure
- //
- Private->VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo->bV4Width = ModeData->HorizontalResolution;
- Private->VirtualScreenInfo->bV4Height = ModeData->VerticalResolution;
- Private->VirtualScreenInfo->bV4Planes = 1;
- Private->VirtualScreenInfo->bV4BitCount = 32;
- //
- // uncompressed
- //
- Private->VirtualScreenInfo->bV4V4Compression = BI_RGB;
-
- //
- // The rest of the allocated memory block is the virtual screen buffer
- //
- Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
-
- //
- // Use the AdjuctWindowRect fuction to calculate the real width and height
- // of the new window including the border and caption
- //
- Rect.left = 0;
- Rect.top = 0;
- Rect.right = ModeData->HorizontalResolution;
- Rect.bottom = ModeData->VerticalResolution;
-
- Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
- Width = Rect.right - Rect.left;
- Height = Rect.bottom - Rect.top;
-
- //
- // Retrieve the original window position information
- //
- Private->WinNtThunk->GetWindowRect (Private->WindowHandle, &Rect);
-
- //
- // Adjust the window size
- //
- Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);
-
- }
-
- NewFillLine = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution);
- if (NewFillLine == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- if (Private->FillLine != NULL) {
- FreePool (Private->FillLine);
- }
-
- Private->FillLine = NewFillLine;
-
- Fill.Red = 0x00;
- Fill.Green = 0x00;
- Fill.Blue = 0x00;
- This->Blt (
- This,
- &Fill,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->HorizontalResolution,
- ModeData->VerticalResolution,
- ModeData->HorizontalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- return EFI_SUCCESS;
-}
-
-
-/**
- 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
- bigger than the current video screen the image will be clipped.
-
- @param This Protocol instance pointer.
- @param X X location on graphics screen.
- @param Y Y location on the graphics screen.
- @param Width Width of BltBuffer.
- @param Height Hight of BltBuffer
- @param BltOperation Operation to perform on BltBuffer and video memory
- @param BltBuffer Buffer containing data to blt into video buffer.
- This buffer has a size of
- Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- @param SourceX If the BltOperation is a EfiCopyBlt this is the
- source of the copy. For other BLT operations this
- argument is not used.
- @param SourceX If the BltOperation is a EfiCopyBlt this is the
- source of the copy. For other BLT operations this
- argument is not used.
-
- @retval EFI_SUCCESS The palette is updated with PaletteArray.
- @retval EFI_INVALID_PARAMETER BltOperation is not valid.
- @retval EFI_DEVICE_ERROR A hardware error occured writting to the video
- buffer.
-
-**/
-// TODO: SourceY - add argument and description to function comment
-// TODO: DestinationX - add argument and description to function comment
-// TODO: DestinationY - add argument and description to function comment
-// TODO: Delta - add argument and description to function comment
-EFI_STATUS
-EFIAPI
-WinNtGopBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-{
- GOP_PRIVATE_DATA *Private;
- EFI_TPL OriginalTPL;
- UINTN DstY;
- UINTN SrcY;
- RGBQUAD *VScreen;
- RGBQUAD *VScreenSrc;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- UINTN Index;
- RECT Rect;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillPixel;
- UINT32 VerticalResolution;
- UINT32 HorizontalResolution;
-
- Private = GOP_PRIVATE_DATA_FROM_THIS (This);
-
- if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // If Delta is zero, then the entire BltBuffer is being used, so Delta
- // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
- // the number of bytes in each row can be computed.
- //
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- }
-
- //
- // We need to fill the Virtual Screen buffer with the blt data.
- // The virtual screen is upside down, as the first row is the bootom row of
- // the image.
- //
- VerticalResolution = This->Mode->Info->VerticalResolution;
- HorizontalResolution = This->Mode->Info->HorizontalResolution;
- if (BltOperation == EfiBltVideoToBltBuffer) {
-
- //
- // Video to BltBuffer: Source is Video, destination is BltBuffer
- //
- if (SourceY + Height > VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (SourceX + Width > HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
- Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- VScreen = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
- CopyMem (Blt, VScreen, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * Width);
- }
- } else {
- //
- // BltBuffer to Video: Source is BltBuffer, destination is Video
- //
- if (DestinationY + Height > VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DestinationX + Width > HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- if (BltOperation == EfiBltVideoFill) {
- FillPixel = BltBuffer;
- for (Index = 0; Index < Width; Index++) {
- Private->FillLine[Index] = *FillPixel;
- }
- }
-
- for (Index = 0; Index < Height; Index++) {
- if (DestinationY <= SourceY) {
- SrcY = SourceY + Index;
- DstY = DestinationY + Index;
- } else {
- SrcY = SourceY + Height - Index - 1;
- DstY = DestinationY + Height - Index - 1;
- }
-
- VScreen = &Private->VirtualScreen[(VerticalResolution - DstY - 1) * HorizontalResolution + DestinationX];
- switch (BltOperation) {
- case EfiBltBufferToVideo:
- Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- CopyMem (VScreen, Blt, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- break;
-
- case EfiBltVideoToVideo:
- VScreenSrc = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
- CopyMem (VScreen, VScreenSrc, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- break;
-
- case EfiBltVideoFill:
- CopyMem (VScreen, Private->FillLine, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- break;
- }
- }
- }
-
- if (BltOperation != EfiBltVideoToBltBuffer) {
- //
- // Mark the area we just blted as Invalid so WM_PAINT will update.
- //
- Rect.left = DestinationX;
- Rect.top = DestinationY;
- Rect.right = DestinationX + Width;
- Rect.bottom = DestinationY + Height;
- Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);
-
- //
- // Send the WM_PAINT message to the thread that is drawing the window. We
- // are in the main thread and the window drawing is in a child thread.
- // There is a child thread per window. We have no CriticalSection or Mutex
- // since we write the data and the other thread displays the data. While
- // 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);
- }
-
- gBS->RestoreTPL (OriginalTPL);
-
- return EFI_SUCCESS;
-}
-
-//
-// Construction and Destruction functions
-//
-
-
-/**
-
-
- @return None
-
-**/
-// TODO: WinNtIo - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopSupported (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
- )
-{
- //
- // Check to see if the IO abstraction represents a device type we support.
- //
- // This would be replaced a check of PCI subsystem ID, etc.
- //
- if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtGopGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Win32 Windows event handler.
-
- See Win32 Book
-
- @return See Win32 Book
-
-**/
-// TODO: hwnd - add argument and description to function comment
-// TODO: iMsg - add argument and description to function comment
-// TODO: wParam - add argument and description to function comment
-// TODO: lParam - add argument and description to function comment
-LRESULT
-CALLBACK
-WinNtGopThreadWindowProc (
- IN HWND hwnd,
- IN UINT iMsg,
- IN WPARAM wParam,
- IN LPARAM lParam
- )
-{
- GOP_PRIVATE_DATA *Private;
- UINTN Size;
- HDC Handle;
- PAINTSTRUCT PaintStruct;
- LPARAM Index;
- EFI_INPUT_KEY Key;
-
- //
- // BugBug - if there are two instances of this DLL in memory (such as is
- // the case for ERM), the correct instance of this function may not be called.
- // This also means that the address of the mTlsIndex value will be wrong, and
- // the value may be wrong too.
- //
-
-
- //
- // Use mTlsIndex global to get a Thread Local Storage version of Private.
- // This works since each Gop protocol has a unique Private data instance and
- // a unique thread.
- //
- Private = mWinNt->TlsGetValue (mTlsIndex);
- ASSERT (NULL != Private);
-
- switch (iMsg) {
- case WM_CREATE:
- Size = Private->GraphicsOutput.Mode->Info->HorizontalResolution * Private->GraphicsOutput.Mode->Info->VerticalResolution * sizeof (RGBQUAD);
-
- //
- // Allocate DIB frame buffer directly from NT for performance enhancement
- // This buffer is the virtual screen/frame buffer. This buffer is not the
- // same a a frame buffer. The first fow of this buffer will be the bottom
- // line of the image. This is an artifact of the way we draw to the screen.
- //
- Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
- Private->WinNtThunk->GetProcessHeap (),
- HEAP_ZERO_MEMORY,
- Size
- );
-
- Private->VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo->bV4Width = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
- Private->VirtualScreenInfo->bV4Height = Private->GraphicsOutput.Mode->Info->VerticalResolution;
- Private->VirtualScreenInfo->bV4Planes = 1;
- Private->VirtualScreenInfo->bV4BitCount = 32;
- //
- // uncompressed
- //
- Private->VirtualScreenInfo->bV4V4Compression = BI_RGB;
- Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
- return 0;
-
- case WM_PAINT:
- //
- // I have not found a way to convert hwnd into a Private context. So for
- // now we use this API to convert hwnd to Private data.
- //
-
- Handle = mWinNt->BeginPaint (hwnd, &PaintStruct);
-
- mWinNt->SetDIBitsToDevice (
- Handle, // Destination Device Context
- 0, // Destination X - 0
- 0, // Destination Y - 0
- Private->GraphicsOutput.Mode->Info->HorizontalResolution, // Width
- Private->GraphicsOutput.Mode->Info->VerticalResolution, // Height
- 0, // Source X
- 0, // Source Y
- 0, // DIB Start Scan Line
- Private->GraphicsOutput.Mode->Info->VerticalResolution, // Number of scan lines
- Private->VirtualScreen, // Address of array of DIB bits
- (BITMAPINFO *) Private->VirtualScreenInfo, // Address of structure with bitmap info
- DIB_RGB_COLORS // RGB or palette indexes
- );
-
- mWinNt->EndPaint (hwnd, &PaintStruct);
- return 0;
-
- //
- // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
- //
- case WM_SYSKEYDOWN:
- Key.ScanCode = 0;
- switch (wParam) {
- case VK_F10:
- Key.ScanCode = SCAN_F10;
- Key.UnicodeChar = 0;
- GopPrivateAddQ (Private, Key);
- return 0;
- }
- break;
-
- case WM_KEYDOWN:
- Key.ScanCode = 0;
- switch (wParam) {
- case VK_HOME: Key.ScanCode = SCAN_HOME; break;
- case VK_END: Key.ScanCode = SCAN_END; break;
- case VK_LEFT: Key.ScanCode = SCAN_LEFT; break;
- case VK_RIGHT: Key.ScanCode = SCAN_RIGHT; break;
- case VK_UP: Key.ScanCode = SCAN_UP; break;
- case VK_DOWN: Key.ScanCode = SCAN_DOWN; break;
- case VK_DELETE: Key.ScanCode = SCAN_DELETE; break;
- case VK_INSERT: Key.ScanCode = SCAN_INSERT; break;
- case VK_PRIOR: Key.ScanCode = SCAN_PAGE_UP; break;
- case VK_NEXT: Key.ScanCode = SCAN_PAGE_DOWN; break;
- case VK_ESCAPE: Key.ScanCode = SCAN_ESC; break;
-
- case VK_F1: Key.ScanCode = SCAN_F1; break;
- case VK_F2: Key.ScanCode = SCAN_F2; break;
- case VK_F3: Key.ScanCode = SCAN_F3; break;
- case VK_F4: Key.ScanCode = SCAN_F4; break;
- case VK_F5: Key.ScanCode = SCAN_F5; break;
- case VK_F6: Key.ScanCode = SCAN_F6; break;
- case VK_F7: Key.ScanCode = SCAN_F7; break;
- 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;
- }
-
- if (Key.ScanCode != 0) {
- Key.UnicodeChar = 0;
- GopPrivateAddQ (Private, Key);
- }
-
- return 0;
-
- case WM_CHAR:
- //
- // The ESC key also generate WM_CHAR.
- //
- if (wParam == 0x1B) {
- return 0;
- }
-
- for (Index = 0; Index < (lParam & 0xffff); Index++) {
- if (wParam != 0) {
- Key.UnicodeChar = (CHAR16) wParam;
- Key.ScanCode = 0;
- GopPrivateAddQ (Private, Key);
- }
- }
-
- return 0;
-
- case WM_CLOSE:
- //
- // This close message is issued by user, core is not aware of this,
- // so don't release the window display resource, just hide the window.
- //
- Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_HIDE);
- return 0;
-
- case WM_DESTROY:
- mWinNt->DestroyWindow (hwnd);
- mWinNt->PostQuitMessage (0);
-
- mWinNt->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
- mWinNt->ExitThread (0);
- return 0;
-
- default:
- break;
- };
-
- return mWinNt->DefWindowProc (hwnd, iMsg, wParam, lParam);
-}
-
-
-/**
- This thread simulates the end of WinMain () aplication. Each Winow nededs
- to process it's events. The messages are dispatched to
- WinNtGopThreadWindowProc ().
- Be very careful sine WinNtGopThreadWinMain () and WinNtGopThreadWindowProc ()
- are running in a seperate thread. We have to do this to process the events.
-
- @param lpParameter Handle of window to manage.
-
- @return if a WM_QUIT message is returned exit.
-
-**/
-DWORD
-WINAPI
-WinNtGopThreadWinMain (
- LPVOID lpParameter
- )
-{
- MSG Message;
- GOP_PRIVATE_DATA *Private;
- ATOM Atom;
- RECT Rect;
-
- Private = (GOP_PRIVATE_DATA *) lpParameter;
- ASSERT (NULL != Private);
-
- //
- // Since each thread has unique private data, save the private data in Thread
- // Local Storage slot. Then the shared global mTlsIndex can be used to get
- // thread specific context.
- //
- Private->WinNtThunk->TlsSetValue (mTlsIndex, Private);
-
- Private->ThreadId = Private->WinNtThunk->GetCurrentThreadId ();
-
- Private->WindowsClass.cbSize = sizeof (WNDCLASSEX);
- Private->WindowsClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
- Private->WindowsClass.lpfnWndProc = WinNtGopThreadWindowProc;
- Private->WindowsClass.cbClsExtra = 0;
- Private->WindowsClass.cbWndExtra = 0;
- Private->WindowsClass.hInstance = NULL;
- Private->WindowsClass.hIcon = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
- Private->WindowsClass.hCursor = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);
- Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;
- Private->WindowsClass.lpszMenuName = NULL;
- Private->WindowsClass.lpszClassName = WIN_NT_GOP_CLASS_NAME;
- Private->WindowsClass.hIconSm = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
-
- //
- // This call will fail after the first time, but thats O.K. since we only need
- // WIN_NT_GOP_CLASS_NAME to exist to create the window.
- //
- // Note: Multiple instances of this DLL will use the same instance of this
- // Class, including the callback function, unless the Class is unregistered and
- // successfully registered again.
- //
- Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);
-
- //
- // Setting Rect values to allow for the AdjustWindowRect to provide
- // us the correct sizes for the client area when doing the CreateWindowEx
- //
- Rect.top = 0;
- Rect.bottom = Private->GraphicsOutput.Mode->Info->VerticalResolution;
- Rect.left = 0;
- Rect.right = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
-
- Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
- Private->WindowHandle = Private->WinNtThunk->CreateWindowEx (
- 0,
- WIN_NT_GOP_CLASS_NAME,
- Private->WindowName,
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- Rect.right - Rect.left,
- Rect.bottom - Rect.top,
- NULL,
- NULL,
- NULL,
- &Private
- );
-
- //
- // The reset of this thread is the standard winows program. We need a sperate
- // thread since we must process the message loop to make windows act like
- // windows.
- //
-
- Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_SHOW);
- Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
-
- //
- // Let the main thread get some work done
- //
- Private->WinNtThunk->ReleaseSemaphore (Private->ThreadInited, 1, NULL);
-
- //
- // This is the message loop that all Windows programs need.
- //
- while (Private->WinNtThunk->GetMessage (&Message, Private->WindowHandle, 0, 0)) {
- Private->WinNtThunk->TranslateMessage (&Message);
- Private->WinNtThunk->DispatchMessage (&Message);
- }
-
- return Message.wParam;
-}
-
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param HorizontalResolution TODO: add argument description
- @param VerticalResolution TODO: add argument description
- @param ColorDepth TODO: add argument description
- @param RefreshRate TODO: add argument description
-
- @return TODO: add return values
-
-**/
-EFI_STATUS
-WinNtGopStartWindow (
- IN GOP_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-{
- EFI_STATUS Status;
- DWORD NewThreadId;
-
- mWinNt = Private->WinNtThunk;
-
- //
- // Initialize a Thread Local Storge variable slot. We use TLS to get the
- // correct Private data instance into the windows thread.
- //
- if (mTlsIndex == TLS_OUT_OF_INDEXES) {
- ASSERT (0 == mTlsIndexUseCount);
- mTlsIndex = Private->WinNtThunk->TlsAlloc ();
- }
-
- //
- // always increase the use count!
- //
- mTlsIndexUseCount++;
-
- //
- // Register to be notified on exit boot services so we can destroy the window.
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_CALLBACK,
- KillNtGopThread,
- Private,
- &mGopScreenExitBootServicesEvent
- );
-
- Private->ThreadInited = Private->WinNtThunk->CreateSemaphore (NULL, 0, 1, NULL);
- Private->ThreadHandle = Private->WinNtThunk->CreateThread (
- NULL,
- 0,
- WinNtGopThreadWinMain,
- (VOID *) Private,
- 0,
- &NewThreadId
- );
-
- //
- // The other thread has entered the windows message loop so we can
- // continue our initialization.
- //
- Private->WinNtThunk->WaitForSingleObject (Private->ThreadInited, INFINITE);
- Private->WinNtThunk->CloseHandle (Private->ThreadInited);
-
- return Status;
-}
-
-
-/**
-
-
- @return None
-
-**/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopConstructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- Private->ModeData = mGopModeData;
-
- Private->GraphicsOutput.QueryMode = WinNtGopQuerytMode;
- Private->GraphicsOutput.SetMode = WinNtGopSetMode;
- Private->GraphicsOutput.Blt = WinNtGopBlt;
-
- //
- // Allocate buffer for Graphics Output Protocol mode information
- //
- Private->GraphicsOutput.Mode = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE));
- if (Private->GraphicsOutput.Mode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- 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.
- //
- Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
- Private->GraphicsOutput.Mode->Info->Version = 0;
- Private->GraphicsOutput.Mode->Info->HorizontalResolution = 0;
- Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
- Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
- Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
- Private->GraphicsOutput.Mode->FrameBufferSize = 0;
-
- Private->HardwareNeedsStarting = TRUE;
- Private->FillLine = NULL;
-
- WinNtGopInitializeSimpleTextInForWindow (Private);
-
- return EFI_SUCCESS;
-}
-
-
-/**
-
-
- @return None
-
-**/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-EFI_STATUS
-WinNtGopDestructor (
- GOP_PRIVATE_DATA *Private
- )
-{
- UINT32 UnregisterReturn;
-
- if (!Private->HardwareNeedsStarting) {
- //
- // BugBug: Shutdown GOP Hardware and any child devices.
- //
- Private->WinNtThunk->SendMessage (Private->WindowHandle, WM_DESTROY, 0, 0);
- Private->WinNtThunk->CloseHandle (Private->ThreadHandle);
-
- mTlsIndexUseCount--;
-
- //
- // The callback function for another window could still be called,
- // so we need to make sure there are no more users of mTlsIndex.
- //
- if (0 == mTlsIndexUseCount) {
- ASSERT (TLS_OUT_OF_INDEXES != mTlsIndex);
-
- Private->WinNtThunk->TlsFree (mTlsIndex);
- mTlsIndex = TLS_OUT_OF_INDEXES;
-
- UnregisterReturn = Private->WinNtThunk->UnregisterClass (
- Private->WindowsClass.lpszClassName,
- Private->WindowsClass.hInstance
- );
- }
-
- WinNtGopDestroySimpleTextInForWindow (Private);
- }
-
- //
- // Free graphics output protocol occupied resource
- //
- if (Private->GraphicsOutput.Mode != NULL) {
- if (Private->GraphicsOutput.Mode->Info != NULL) {
- FreePool (Private->GraphicsOutput.Mode->Info);
- }
- FreePool (Private->GraphicsOutput.Mode);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- This is the GOP screen's callback notification function for exit-boot-services.
- All we do here is call WinNtGopDestructor().
-
- @param Event not used
- @param Context pointer to the Private structure.
-
- @return None.
-
-**/
-STATIC
-VOID
-EFIAPI
-KillNtGopThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- Status = WinNtGopDestructor (Context);
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c
deleted file mode 100644
index d22f030f4b..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "WinNtSerialIo.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtSerialIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtSerialIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtSerialIoComponentName = {
- WinNtSerialIoComponentNameGetDriverName,
- WinNtSerialIoComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtSerialIoDriverNameTable[] = {
- { "eng", L"Windows Serial I/O Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtSerialIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtSerialIoComponentName.SupportedLanguages,
- mWinNtSerialIoDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSerialIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtSerialIoDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // This is a bus driver, so ChildHandle must not be NULL.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiSerialIoProtocolGuid,
- &SerialIo,
- gWinNtSerialIoDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);
-
- return LookupUnicodeString (
- Language,
- gWinNtSerialIoComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
deleted file mode 100644
index 954c0e179c..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.c
+++ /dev/null
@@ -1,1406 +0,0 @@
-/*++
-
-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:
-
- WinNtSerialIo.c
-
-Abstract:
-
- Our DriverBinding member functions operate on the handles
- created by the NT Bus driver.
-
- Handle(1) - WinNtIo - DevicePath(1)
-
- 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.
-
- Handle(2) - SerialIo - DevicePath(1)\UART
-
- The driver then adds a gEfiWinNtSerialPortGuid as a protocol to Handle(1).
- The instance data for this protocol is the private data used to create
- Handle(2).
-
- Handle(1) - WinNtIo - DevicePath(1) - WinNtSerialPort
-
- 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
- loaded on the device.
-
---*/
-
-#include "WinNtSerialIo.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding = {
- WinNtSerialIoDriverBindingSupported,
- WinNtSerialIoDriverBindingStart,
- WinNtSerialIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- UART_DEVICE_PATH *UartNode;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- &ParentDevicePath,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure that the WinNt Thunk Protocol is valid
- //
- if (WinNtIo->WinNtThunk->Signature != EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {
- Status = EFI_UNSUPPORTED;
- goto Error;
- }
-
- //
- // Check the GUID to see if this is a handle type the driver supports
- //
- if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtSerialPortGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Error;
- }
-
- if (RemainingDevicePath != NULL) {
- Status = EFI_UNSUPPORTED;
- UartNode = (UART_DEVICE_PATH *) RemainingDevicePath;
- if (UartNode->Header.Type != MESSAGING_DEVICE_PATH ||
- UartNode->Header.SubType != MSG_UART_DP ||
- DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) {
- goto Error;
- }
- if (UartNode->BaudRate < 0 || UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {
- goto Error;
- }
- if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) {
- goto Error;
- }
- if (UartNode->DataBits < 5 || UartNode->DataBits > 8) {
- goto Error;
- }
- if (UartNode->StopBits < OneStopBit || UartNode->StopBits > TwoStopBits) {
- goto Error;
- }
- if ((UartNode->DataBits == 5) && (UartNode->StopBits == TwoStopBits)) {
- goto Error;
- }
- if ((UartNode->DataBits >= 6) && (UartNode->DataBits <= 8) && (UartNode->StopBits == OneFiveStopBits)) {
- goto Error;
- }
- Status = EFI_SUCCESS;
- }
-
-Error:
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- HANDLE NtHandle;
- UART_DEVICE_PATH Node;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
-
- Private = NULL;
- NtHandle = INVALID_HANDLE_VALUE;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- &ParentDevicePath,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- //
- // Grab the IO abstraction we need to get any work done
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
- }
-
- if (Status == EFI_ALREADY_STARTED) {
-
- if (RemainingDevicePath == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Make sure a child handle does not already exist. This driver can only
- // produce one child per serial port.
- //
- Status = gBS->OpenProtocolInformation (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = EFI_ALREADY_STARTED;
- for (Index = 0; Index < EntryCount; Index++) {
- if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
- Status = gBS->OpenProtocol (
- OpenInfoBuffer[Index].ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- &SerialIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- CopyMem (&Node, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
- Status = SerialIo->SetAttributes (
- SerialIo,
- Node.BaudRate,
- SerialIo->Mode->ReceiveFifoDepth,
- SerialIo->Mode->Timeout,
- Node.Parity,
- Node.DataBits,
- Node.StopBits
- );
- }
- break;
- }
- }
-
- FreePool (OpenInfoBuffer);
- return Status;
- }
-
- //
- // Check to see if we can access the hardware device. If it's Open in NT we
- // will not get access.
- //
- NtHandle = WinNtIo->WinNtThunk->CreateFile (
- WinNtIo->EnvString,
- GENERIC_READ | GENERIC_WRITE,
- 0,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
- if (NtHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_DEVICE_ERROR;
- goto Error;
- }
-
- //
- // Construct Private data
- //
- Private = AllocatePool (sizeof (WIN_NT_SERIAL_IO_PRIVATE_DATA));
- if (Private == NULL) {
- goto Error;
- }
-
- //
- // This signature must be valid before any member function is called
- //
- Private->Signature = WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE;
- Private->NtHandle = NtHandle;
- Private->ControllerHandle = Handle;
- Private->Handle = NULL;
- Private->WinNtThunk = WinNtIo->WinNtThunk;
- Private->ParentDevicePath = ParentDevicePath;
- Private->ControllerNameTable = NULL;
-
- Private->SoftwareLoopbackEnable = FALSE;
- Private->HardwareLoopbackEnable = FALSE;
- Private->HardwareFlowControl = FALSE;
- Private->Fifo.First = 0;
- Private->Fifo.Last = 0;
- Private->Fifo.Surplus = SERIAL_MAX_BUFFER_SIZE;
-
- AddUnicodeString (
- "eng",
- gWinNtSerialIoComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WinNtIo->EnvString
- );
-
- Private->SerialIo.Revision = SERIAL_IO_INTERFACE_REVISION;
- Private->SerialIo.Reset = WinNtSerialIoReset;
- Private->SerialIo.SetAttributes = WinNtSerialIoSetAttributes;
- Private->SerialIo.SetControl = WinNtSerialIoSetControl;
- Private->SerialIo.GetControl = WinNtSerialIoGetControl;
- Private->SerialIo.Write = WinNtSerialIoWrite;
- Private->SerialIo.Read = WinNtSerialIoRead;
- Private->SerialIo.Mode = &Private->SerialIoMode;
-
- if (RemainingDevicePath != NULL) {
- //
- // Match the configuration of the RemainingDevicePath. IsHandleSupported()
- // already checked to make sure the RemainingDevicePath contains settings
- // that we can support.
- //
- CopyMem (&Private->UartDevicePath, RemainingDevicePath, sizeof (UART_DEVICE_PATH));
- } else {
- //
- // Build the device path by appending the UART node to the ParentDevicePath
- // from the WinNtIo handle. The Uart setings are zero here, since
- // SetAttribute() will update them to match the default setings.
- //
- ZeroMem (&Private->UartDevicePath, sizeof (UART_DEVICE_PATH));
- Private->UartDevicePath.Header.Type = MESSAGING_DEVICE_PATH;
- Private->UartDevicePath.Header.SubType = MSG_UART_DP;
- SetDevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath, sizeof (UART_DEVICE_PATH));
- }
-
- //
- // Build the device path by appending the UART node to the ParentDevicePath
- // from the WinNtIo handle. The Uart setings are zero here, since
- // SetAttribute() will update them to match the current setings.
- //
- Private->DevicePath = AppendDevicePathNode (
- ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
- );
- if (Private->DevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- //
- // Fill in Serial I/O Mode structure based on either the RemainingDevicePath or defaults.
- //
- Private->SerialIoMode.ControlMask = SERIAL_CONTROL_MASK;
- Private->SerialIoMode.Timeout = SERIAL_TIMEOUT_DEFAULT;
- Private->SerialIoMode.BaudRate = Private->UartDevicePath.BaudRate;
- Private->SerialIoMode.ReceiveFifoDepth = SERIAL_FIFO_DEFAULT;
- Private->SerialIoMode.DataBits = Private->UartDevicePath.DataBits;
- Private->SerialIoMode.Parity = Private->UartDevicePath.Parity;
- Private->SerialIoMode.StopBits = Private->UartDevicePath.StopBits;
-
- //
- // Issue a reset to initialize the COM port
- //
- Status = Private->SerialIo.Reset (&Private->SerialIo);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Create new child handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiSerialIoProtocolGuid,
- &Private->SerialIo,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Private->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- return EFI_SUCCESS;
-
-Error:
- //
- // Use the Stop() function to free all resources allocated in Start()
- //
- if (Private != NULL) {
- if (Private->Handle != NULL) {
- This->Stop (This, Handle, 1, &Private->Handle);
- } else {
- if (NtHandle != INVALID_HANDLE_VALUE) {
- Private->WinNtThunk->CloseHandle (NtHandle);
- }
-
- if (Private->DevicePath != NULL) {
- FreePool (Private->DevicePath);
- }
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
- }
-
- This->Stop (This, Handle, 0, NULL);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
- return Status;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiSerialIoProtocolGuid,
- &SerialIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (SerialIo);
-
- ASSERT (Private->Handle == ChildHandleBuffer[Index]);
-
- Status = gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiSerialIoProtocolGuid,
- &Private->SerialIo,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- (VOID **) &WinNtIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- Private->WinNtThunk->CloseHandle (Private->NtHandle);
-
- FreePool (Private->DevicePath);
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Serial IO Protocol member functions
-//
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoReset (
- IN EFI_SERIAL_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Private->WinNtThunk->PurgeComm (
- Private->NtHandle,
- PURGE_TXCLEAR | PURGE_RXCLEAR
- );
-
- gBS->RestoreTPL (Tpl);
-
- return This->SetAttributes (
- This,
- This->Mode->BaudRate,
- This->Mode->ReceiveFifoDepth,
- This->Mode->Timeout,
- This->Mode->Parity,
- (UINT8) This->Mode->DataBits,
- This->Mode->StopBits
- );
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoSetAttributes (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-/*++
-
-Routine Description:
-
- This function is used to set the attributes.
-
-Arguments:
-
- 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.
- Parity - The type of parity used in serial device.
- DataBits - Number of deata bits used in serial device.
- StopBits - Number of stop bits used in serial device.
-
-Returns:
- Status code
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- COMMTIMEOUTS PortTimeOuts;
- DWORD ConvertedTime;
- BOOL Result;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Some of our arguments have defaults if a null value is passed in, and
- // we must set the default values if a null argument is passed in.
- //
- if (BaudRate == 0) {
- BaudRate = SERIAL_BAUD_DEFAULT;
- }
-
- if (ReceiveFifoDepth == 0) {
- ReceiveFifoDepth = SERIAL_FIFO_DEFAULT;
- }
-
- if (Timeout == 0) {
- Timeout = SERIAL_TIMEOUT_DEFAULT;
- }
-
- if (Parity == DefaultParity) {
- Parity = NoParity;
- }
-
- if (DataBits == 0) {
- DataBits = SERIAL_DATABITS_DEFAULT;
- }
-
- if (StopBits == DefaultStopBits) {
- StopBits = OneStopBit;
- }
- //
- // See if the new attributes already match the current attributes
- //
- if (Private->UartDevicePath.BaudRate == BaudRate &&
- Private->UartDevicePath.DataBits == DataBits &&
- Private->UartDevicePath.Parity == Parity &&
- Private->UartDevicePath.StopBits == StopBits &&
- Private->SerialIoMode.ReceiveFifoDepth == ReceiveFifoDepth &&
- Private->SerialIoMode.Timeout == Timeout ) {
- gBS->RestoreTPL(Tpl);
- return EFI_SUCCESS;
- }
-
- //
- // Get current values from NT
- //
- ZeroMem (&Private->NtDCB, sizeof (DCB));
- Private->NtDCB.DCBlength = sizeof (DCB);
-
- if (!Private->WinNtThunk->GetCommState (Private->NtHandle, &Private->NtDCB)) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialSetAttributes: GetCommState %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Map EFI com setting to NT
- //
- Private->NtDCB.BaudRate = ConvertBaud2Nt (BaudRate);
- Private->NtDCB.ByteSize = ConvertData2Nt (DataBits);
- Private->NtDCB.Parity = ConvertParity2Nt (Parity);
- Private->NtDCB.StopBits = ConvertStop2Nt (StopBits);
-
- Private->NtDCB.fBinary = TRUE;
- Private->NtDCB.fParity = Private->NtDCB.Parity == NOPARITY ? FALSE : TRUE;
- Private->NtDCB.fOutxCtsFlow = FALSE;
- Private->NtDCB.fOutxDsrFlow = FALSE;
- Private->NtDCB.fDtrControl = DTR_CONTROL_ENABLE;
- Private->NtDCB.fDsrSensitivity = FALSE;
- Private->NtDCB.fOutX = FALSE;
- Private->NtDCB.fInX = FALSE;
- Private->NtDCB.fRtsControl = RTS_CONTROL_ENABLE;
- Private->NtDCB.fNull = FALSE;
-
- //
- // Set new values
- //
- Result = Private->WinNtThunk->SetCommState (Private->NtHandle, &Private->NtDCB);
- if (!Result) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialSetAttributes: SetCommState %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Set com port read/write timeout values
- //
- ConvertedTime = ConvertTime2Nt (Timeout);
- PortTimeOuts.ReadIntervalTimeout = MAXDWORD;
- PortTimeOuts.ReadTotalTimeoutMultiplier = 0;
- PortTimeOuts.ReadTotalTimeoutConstant = ConvertedTime;
- PortTimeOuts.WriteTotalTimeoutMultiplier = ConvertedTime == 0 ? 1 : ConvertedTime;
- PortTimeOuts.WriteTotalTimeoutConstant = 0;
-
- if (!Private->WinNtThunk->SetCommTimeouts (Private->NtHandle, &PortTimeOuts)) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialSetAttributes: SetCommTimeouts %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Update mode
- //
- Private->SerialIoMode.BaudRate = BaudRate;
- Private->SerialIoMode.ReceiveFifoDepth = ReceiveFifoDepth;
- Private->SerialIoMode.Timeout = Timeout;
- Private->SerialIoMode.Parity = Parity;
- Private->SerialIoMode.DataBits = DataBits;
- Private->SerialIoMode.StopBits = StopBits;
-
- //
- // See if Device Path Node has actually changed
- //
- if (Private->UartDevicePath.BaudRate == BaudRate &&
- Private->UartDevicePath.DataBits == DataBits &&
- Private->UartDevicePath.Parity == Parity &&
- Private->UartDevicePath.StopBits == StopBits ) {
- gBS->RestoreTPL(Tpl);
- return EFI_SUCCESS;
- }
-
- //
- // Update the device path
- //
- Private->UartDevicePath.BaudRate = BaudRate;
- Private->UartDevicePath.DataBits = DataBits;
- Private->UartDevicePath.Parity = (UINT8) Parity;
- Private->UartDevicePath.StopBits = (UINT8) StopBits;
-
- NewDevicePath = AppendDevicePathNode (
- Private->ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Private->UartDevicePath
- );
- if (NewDevicePath == NULL) {
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- if (Private->Handle != NULL) {
- Status = gBS->ReinstallProtocolInterface (
- Private->Handle,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- NewDevicePath
- );
- if (EFI_ERROR (Status)) {
- gBS->RestoreTPL (Tpl);
- return Status;
- }
- }
-
- if (Private->DevicePath != NULL) {
- FreePool (Private->DevicePath);
- }
-
- Private->DevicePath = NewDevicePath;
-
- gBS->RestoreTPL (Tpl);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoSetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT32 Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- BOOL Result;
- DCB Dcb;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- Result = Private->WinNtThunk->GetCommState (Private->NtHandle, &Dcb);
-
- if (!Result) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialSetControl: GetCommState %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- Dcb.fRtsControl = RTS_CONTROL_DISABLE;
- Dcb.fDtrControl = DTR_CONTROL_DISABLE;
- Private->HardwareFlowControl = FALSE;
- Private->SoftwareLoopbackEnable = FALSE;
- Private->HardwareLoopbackEnable = FALSE;
-
- if (Control & EFI_SERIAL_REQUEST_TO_SEND) {
- Dcb.fRtsControl = RTS_CONTROL_ENABLE;
- }
-
- if (Control & EFI_SERIAL_DATA_TERMINAL_READY) {
- Dcb.fDtrControl = DTR_CONTROL_ENABLE;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) {
- Private->HardwareFlowControl = TRUE;
- }
-
- if (Control & EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE) {
- Private->SoftwareLoopbackEnable = TRUE;
- }
-
- if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) {
- Private->HardwareLoopbackEnable = TRUE;
- }
-
- Result = Private->WinNtThunk->SetCommState (
- Private->NtHandle,
- &Dcb
- );
-
- if (!Result) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialSetControl: SetCommState %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- gBS->RestoreTPL (Tpl);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoGetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- OUT UINT32 *Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- DWORD ModemStatus;
- DWORD Errors;
- UINT32 Bits;
- DCB Dcb;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Get modem status
- //
- if (!Private->WinNtThunk->GetCommModemStatus (Private->NtHandle, &ModemStatus)) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- Bits = 0;
- if (ModemStatus & MS_CTS_ON) {
- Bits |= EFI_SERIAL_CLEAR_TO_SEND;
- }
-
- if (ModemStatus & MS_DSR_ON) {
- Bits |= EFI_SERIAL_DATA_SET_READY;
- }
-
- if (ModemStatus & MS_RING_ON) {
- Bits |= EFI_SERIAL_RING_INDICATE;
- }
-
- if (ModemStatus & MS_RLSD_ON) {
- Bits |= EFI_SERIAL_CARRIER_DETECT;
- }
-
- //
- // Get ctrl status
- //
- if (!Private->WinNtThunk->GetCommState (Private->NtHandle, &Dcb)) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialGetControl: GetCommState %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- if (Dcb.fDtrControl == DTR_CONTROL_ENABLE) {
- Bits |= EFI_SERIAL_DATA_TERMINAL_READY;
- }
-
- if (Dcb.fRtsControl == RTS_CONTROL_ENABLE) {
- Bits |= EFI_SERIAL_REQUEST_TO_SEND;
- }
-
- if (Private->HardwareFlowControl) {
- Bits |= EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE;
- }
-
- if (Private->SoftwareLoopbackEnable) {
- Bits |= EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE;
- }
-
- if (Private->HardwareLoopbackEnable) {
- Bits |= EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE;
- }
-
- //
- // Get input buffer status
- //
- if (!Private->WinNtThunk->ClearCommError (Private->NtHandle, &Errors, &Private->NtComStatus)) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialGetControl: ClearCommError %d\n", Private->NtError));
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
-
- if (Private->NtComStatus.cbInQue == 0) {
- Bits |= EFI_SERIAL_INPUT_BUFFER_EMPTY;
- }
-
- *Control = Bits;
-
- gBS->RestoreTPL (Tpl);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoWrite (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- UINT8 *ByteBuffer;
- UINTN TotalBytesWritten;
- DWORD BytesToGo;
- DWORD BytesWritten;
- BOOL Result;
- UINT32 Index;
- UINT32 Control;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- ByteBuffer = (UINT8 *) Buffer;
- TotalBytesWritten = 0;
-
- if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {
- for (Index = 0; Index < *BufferSize; Index++) {
- if (IsaSerialFifoAdd (&Private->Fifo, ByteBuffer[Index]) == EFI_SUCCESS) {
- TotalBytesWritten++;
- } else {
- break;
- }
- }
- } else {
- BytesToGo = (DWORD) (*BufferSize);
-
- do {
- if (Private->HardwareFlowControl) {
- //
- // Send RTS
- //
- WinNtSerialIoGetControl (&Private->SerialIo, &Control);
- Control |= EFI_SERIAL_REQUEST_TO_SEND;
- WinNtSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- //
- // Do the write
- //
- Result = Private->WinNtThunk->WriteFile (
- Private->NtHandle,
- &ByteBuffer[TotalBytesWritten],
- BytesToGo,
- &BytesWritten,
- NULL
- );
-
- if (Private->HardwareFlowControl) {
- //
- // Assert RTS
- //
- WinNtSerialIoGetControl (&Private->SerialIo, &Control);
- Control &= ~ (UINT32) EFI_SERIAL_REQUEST_TO_SEND;
- WinNtSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- TotalBytesWritten += BytesWritten;
- BytesToGo -= BytesWritten;
- if (!Result) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- DEBUG ((EFI_D_ERROR, "SerialWrite: FileWrite %d\n", Private->NtError));
- *BufferSize = TotalBytesWritten;
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
- } while (BytesToGo > 0);
- }
-
- *BufferSize = TotalBytesWritten;
-
- gBS->RestoreTPL (Tpl);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoRead (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
-
---*/
-{
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private;
- BOOL Result;
- DWORD BytesRead;
- EFI_STATUS Status;
- UINT32 Index;
- UINT8 Data;
- UINT32 Control;
- EFI_TPL Tpl;
-
- Tpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Do the read
- //
- if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {
- for (Index = 0, BytesRead = 0; Index < *BufferSize; Index++) {
- if (IsaSerialFifoRemove (&Private->Fifo, &Data) == EFI_SUCCESS) {
- ((UINT8 *) Buffer)[Index] = Data;
- BytesRead++;
- } else {
- break;
- }
- }
- } else {
- if (Private->HardwareFlowControl) {
- WinNtSerialIoGetControl (&Private->SerialIo, &Control);
- Control |= EFI_SERIAL_DATA_TERMINAL_READY;
- WinNtSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- Result = Private->WinNtThunk->ReadFile (
- Private->NtHandle,
- Buffer,
- (DWORD) *BufferSize,
- &BytesRead,
- NULL
- );
-
- if (Private->HardwareFlowControl) {
- WinNtSerialIoGetControl (&Private->SerialIo, &Control);
- Control &= ~ (UINT32) EFI_SERIAL_DATA_TERMINAL_READY;
- WinNtSerialIoSetControl (&Private->SerialIo, Control);
- }
-
- if (!Result) {
- Private->NtError = Private->WinNtThunk->GetLastError ();
- gBS->RestoreTPL (Tpl);
- return EFI_DEVICE_ERROR;
- }
- }
-
- if (BytesRead != *BufferSize) {
- Status = EFI_TIMEOUT;
- } else {
- Status = EFI_SUCCESS;
- }
-
- *BufferSize = (UINTN) BytesRead;
-
- gBS->RestoreTPL (Tpl);
-
- return Status;
-}
-
-BOOLEAN
-IsaSerialFifoFull (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
- 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
-
---*/
-{
- if (Fifo->Surplus == 0) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-IsaSerialFifoEmpty (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
- 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
-
---*/
-{
- if (Fifo->Surplus == SERIAL_MAX_BUFFER_SIZE) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-IsaSerialFifoAdd (
- IN SERIAL_DEV_FIFO *Fifo,
- IN UINT8 Data
- )
-/*++
-
- 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
-
- Returns:
- EFI_SUCCESS: Add data to specific FIFO successfully
- EFI_OUT_RESOURCE: Failed to add data because FIFO is already full
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- //
- // if FIFO full can not add data
- //
- if (IsaSerialFifoFull (Fifo)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // FIFO is not full can add data
- //
- Fifo->Data[Fifo->Last] = Data;
- Fifo->Surplus--;
- Fifo->Last++;
- if (Fifo->Last >= SERIAL_MAX_BUFFER_SIZE) {
- Fifo->Last = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-IsaSerialFifoRemove (
- IN SERIAL_DEV_FIFO *Fifo,
- OUT UINT8 *Data
- )
-/*++
-
- 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
-
- Returns:
- EFI_SUCCESS: Remove data from specific FIFO successfully
- EFI_OUT_RESOURCE: Failed to remove data because FIFO is empty
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- //
- // if FIFO is empty, no data can remove
- //
- if (IsaSerialFifoEmpty (Fifo)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // FIFO is not empty, can remove data
- //
- *Data = Fifo->Data[Fifo->First];
- Fifo->Surplus++;
- Fifo->First++;
- if (Fifo->First >= SERIAL_MAX_BUFFER_SIZE) {
- Fifo->First = 0;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h
deleted file mode 100644
index 79e905c5ad..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.h
+++ /dev/null
@@ -1,513 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtSerialIo.h
-
-Abstract:
-
-
---*/
-
-#ifndef _WIN_NT_SERIAL_IO_
-#define _WIN_NT_SERIAL_IO_
-
-
-
-#define SERIAL_MAX_BUFFER_SIZE 256
-#define TIMEOUT_STALL_INTERVAL 10
-
-typedef struct {
- UINT32 First;
- UINT32 Last;
- UINT32 Surplus;
- UINT8 Data[SERIAL_MAX_BUFFER_SIZE];
-} SERIAL_DEV_FIFO;
-
-#define WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 's', 'i')
-typedef struct {
- UINT64 Signature;
-
- //
- // Protocol data for the new handle we are going to add
- //
- EFI_HANDLE Handle;
- EFI_SERIAL_IO_PROTOCOL SerialIo;
- EFI_SERIAL_IO_MODE SerialIoMode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // Private Data
- //
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- UART_DEVICE_PATH UartDevicePath;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- //
- // Private NT type Data;
- //
- HANDLE NtHandle;
- DCB NtDCB;
- DWORD NtError;
- COMSTAT NtComStatus;
-
- BOOLEAN SoftwareLoopbackEnable;
- BOOLEAN HardwareFlowControl;
- BOOLEAN HardwareLoopbackEnable;
-
- SERIAL_DEV_FIFO Fifo;
-
-} WIN_NT_SERIAL_IO_PRIVATE_DATA;
-
-#define WIN_NT_SERIAL_IO_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, WIN_NT_SERIAL_IO_PRIVATE_DATA, SerialIo, WIN_NT_SERIAL_IO_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSerialIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSerialIoComponentName;
-
-//
-// Macros to convert EFI serial types to NT serial types.
-//
-
-//
-// one second
-//
-#define SERIAL_TIMEOUT_DEFAULT (1000 * 1000)
-#define SERIAL_BAUD_DEFAULT 115200
-#define SERIAL_FIFO_DEFAULT 14
-#define SERIAL_DATABITS_DEFAULT 8
-#define SERIAL_PARITY_DEFAULT DefaultParity
-#define SERIAL_STOPBITS_DEFAULT DefaultStopBits
-
-#define SERIAL_CONTROL_MASK (EFI_SERIAL_CLEAR_TO_SEND | \
- EFI_SERIAL_DATA_SET_READY | \
- EFI_SERIAL_RING_INDICATE | \
- EFI_SERIAL_CARRIER_DETECT | \
- EFI_SERIAL_REQUEST_TO_SEND | \
- EFI_SERIAL_DATA_TERMINAL_READY | \
- EFI_SERIAL_INPUT_BUFFER_EMPTY)
-
-#define ConvertBaud2Nt(x) (DWORD) x
-#define ConvertData2Nt(x) (BYTE) x
-
-#define ConvertParity2Nt(x) \
- (BYTE) ( \
- x == DefaultParity ? NOPARITY : \
- x == NoParity ? NOPARITY : \
- x == EvenParity ? EVENPARITY : \
- x == OddParity ? ODDPARITY : \
- x == MarkParity ? MARKPARITY : \
- x == SpaceParity ? SPACEPARITY : 0 \
- )
-
-#define ConvertStop2Nt(x) \
- (BYTE) ( \
- x == DefaultParity ? ONESTOPBIT : \
- x == OneFiveStopBits ? ONE5STOPBITS : \
- x == TwoStopBits ? TWOSTOPBITS : 0 \
- )
-
-#define ConvertTime2Nt(x) ((x) / 1000)
-
-//
-// 115400 baud with rounding errors
-//
-#define SERIAL_PORT_MAX_BAUD_RATE 115400
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeWinNtSerialIo (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoReset (
- IN EFI_SERIAL_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoSetAttributes (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT64 BaudRate,
- IN UINT32 ReceiveFifoDepth,
- IN UINT32 Timeout,
- IN EFI_PARITY_TYPE Parity,
- IN UINT8 DataBits,
- IN EFI_STOP_BITS_TYPE StopBits
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BaudRate - TODO: add argument description
- ReceiveFifoDepth - TODO: add argument description
- Timeout - TODO: add argument description
- Parity - TODO: add argument description
- DataBits - TODO: add argument description
- StopBits - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoSetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN UINT32 Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoGetControl (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- OUT UINT32 *Control
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Control - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoWrite (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtSerialIoRead (
- IN EFI_SERIAL_IO_PROTOCOL *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsaSerialFifoFull (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsaSerialFifoEmpty (
- IN SERIAL_DEV_FIFO *Fifo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialFifoAdd (
- IN SERIAL_DEV_FIFO *Fifo,
- IN UINT8 Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialFifoRemove (
- IN SERIAL_DEV_FIFO *Fifo,
- OUT UINT8 *Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Fifo - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsaSerialReceiveTransmit (
- WIN_NT_SERIAL_IO_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
deleted file mode 100644
index b7e5107722..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtSerialIo</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>6B41B553-A649-11d4-BD02-0080C73C8881</GuidValue>
- <Version>1.0</Version>
- <Abstract>Serial I/O driver</Abstract>
- <Description>Our DriverBinding member functions operate on the handles
- created by the NT Bus drive</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtSerialIo</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtSerialIo.h</Filename>
- <Filename>WinNtSerialIo.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtSerialPortGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtSerialIoDriverBinding</DriverBinding>
- <ComponentName>gWinNtSerialIoComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c
deleted file mode 100644
index c6240df293..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/ComponentName.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "WinNtSimpleFileSystem.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName = {
- WinNtSimpleFileSystemComponentNameGetDriverName,
- WinNtSimpleFileSystemComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtSimpleFileSystemDriverNameTable[] = {
- {
- "eng",
- L"Windows Simple File System Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtSimpleFileSystemComponentName.SupportedLanguages,
- mWinNtSimpleFileSystemDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &SimpleFileSystem,
- gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-
- return LookupUnicodeString (
- Language,
- gWinNtSimpleFileSystemComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
deleted file mode 100644
index 475dff6224..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.c
+++ /dev/null
@@ -1,2682 +0,0 @@
-/*++
-
-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:
-
- WinNtSimpleFileSystem.c
-
-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*
- Developer Studio for them to work.
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#include "WinNtSimpleFileSystem.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding = {
- WinNtSimpleFileSystemDriverBindingSupported,
- WinNtSimpleFileSystemDriverBindingStart,
- WinNtSimpleFileSystemDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-CHAR16 *
-EfiStrChr (
- IN CHAR16 *Str,
- IN CHAR16 Chr
- )
-/*++
-
-Routine Description:
-
- Locate the first occurance of a character in a string.
-
-Arguments:
-
- Str - Pointer to NULL terminated unicode string.
- Chr - Character to locate.
-
-Returns:
-
- If Str is NULL, then NULL is returned.
- If Chr is not contained in Str, then NULL is returned.
- If Chr is contained in Str, then a pointer to the first occurance of Chr in Str is returned.
-
---*/
-{
- if (Str == NULL) {
- return Str;
- }
-
- while (*Str != '\0' && *Str != Chr) {
- ++Str;
- }
-
- return (*Str == Chr) ? Str : NULL;
-}
-
-BOOLEAN
-IsZero (
- IN VOID *Buffer,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Buffer - TODO: add argument description
- Length - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- if (Buffer == NULL || Length == 0) {
- return FALSE;
- }
-
- if (*(UINT8 *) Buffer != 0) {
- return FALSE;
- }
-
- if (Length > 1) {
- if (!CompareMem (Buffer, (UINT8 *) Buffer + 1, Length - 1)) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-VOID
-CutPrefix (
- IN CHAR16 *Str,
- IN UINTN Count
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Str - TODO: add argument description
- Count - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- CHAR16 *Pointer;
-
- if (StrLen (Str) < Count) {
- ASSERT (0);
- }
-
- if (Count != 0) {
- for (Pointer = Str; *(Pointer + Count); Pointer++) {
- *Pointer = *(Pointer + Count);
- }
- *Pointer = *(Pointer + Count);
- }
-}
-
-
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Check to see if the driver supports a given controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to test.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
- specified by This.
-
- EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- the driver specified by This.
-
- EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- a different driver or an application that requires exclusive access.
-
- EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
- driver specified by This.
-
---*/
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure GUID is for a File System handle.
- //
- Status = EFI_UNSUPPORTED;
- if (CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtFileSystemGuid)) {
- Status = EFI_SUCCESS;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Starts a device controller or a bus controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to start.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device or bus controller has been started.
-
- EFI_DEVICE_ERROR - The device could not be started due to a device failure.
-
- EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
-
---*/
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- Private = NULL;
-
- //
- // Open the IO Abstraction(s) needed
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Validate GUID
- //
- if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtFileSystemGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- Private = AllocatePool (sizeof (WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
-
- goto Done;
- }
-
- Private->Signature = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE;
- Private->WinNtThunk = WinNtIo->WinNtThunk;
-
- Private->FilePath = WinNtIo->EnvString;
-
- Private->VolumeLabel = AllocatePool (StrSize (L"EFI_EMULATED"));
- if (Private->VolumeLabel == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (Private->VolumeLabel, L"EFI_EMULATED");
-
- Private->SimpleFileSystem.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
- Private->SimpleFileSystem.OpenVolume = WinNtSimpleFileSystemOpenVolume;
-
- Private->WinNtThunk->SetErrorMode (SEM_FAILCRITICALERRORS);
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gWinNtSimpleFileSystemComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WinNtIo->EnvString
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &Private->SimpleFileSystem,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- if (Private != NULL) {
-
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - A handle to the device to be stopped.
-
- NumberOfChildren - The number of child device handles in ChildHandleBuffer.
-
- ChildHandleBuffer - An array of child device handles to be freed.
-
-Returns:
-
- EFI_SUCCESS - The device has been stopped.
-
- EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
-
---*/
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &SimpleFileSystem,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
-
- //
- // Uninstall the Simple File System Protocol from ControllerHandle
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- &Private->SimpleFileSystem,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE **Root
- )
-/*++
-
-Routine Description:
-
- Open the root directory on a volume.
-
-Arguments:
-
- This - A pointer to the volume to open.
-
- Root - A pointer to storage for the returned opened file handle of the root directory.
-
-Returns:
-
- EFI_SUCCESS - The volume was opened.
-
- EFI_UNSUPPORTED - The volume does not support the requested file system type.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL || Root == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (This);
-
- PrivateFile = AllocatePool (sizeof (WIN_NT_EFI_FILE_PRIVATE));
- if (PrivateFile == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- PrivateFile->FileName = AllocatePool (StrSize (Private->FilePath));
- if (PrivateFile->FileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- PrivateFile->FilePath = AllocatePool (StrSize (Private->FilePath));
- if (PrivateFile->FilePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (PrivateFile->FilePath, Private->FilePath);
- StrCpy (PrivateFile->FileName, PrivateFile->FilePath);
- PrivateFile->Signature = WIN_NT_EFI_FILE_PRIVATE_SIGNATURE;
- PrivateFile->WinNtThunk = Private->WinNtThunk;
- PrivateFile->SimpleFileSystem = This;
- PrivateFile->IsRootDirectory = TRUE;
- PrivateFile->IsDirectoryPath = TRUE;
- PrivateFile->IsOpenedByRead = TRUE;
- PrivateFile->EfiFile.Revision = EFI_FILE_HANDLE_REVISION;
- PrivateFile->EfiFile.Open = WinNtSimpleFileSystemOpen;
- PrivateFile->EfiFile.Close = WinNtSimpleFileSystemClose;
- PrivateFile->EfiFile.Delete = WinNtSimpleFileSystemDelete;
- PrivateFile->EfiFile.Read = WinNtSimpleFileSystemRead;
- PrivateFile->EfiFile.Write = WinNtSimpleFileSystemWrite;
- PrivateFile->EfiFile.GetPosition = WinNtSimpleFileSystemGetPosition;
- PrivateFile->EfiFile.SetPosition = WinNtSimpleFileSystemSetPosition;
- PrivateFile->EfiFile.GetInfo = WinNtSimpleFileSystemGetInfo;
- PrivateFile->EfiFile.SetInfo = WinNtSimpleFileSystemSetInfo;
- PrivateFile->EfiFile.Flush = WinNtSimpleFileSystemFlush;
- PrivateFile->LHandle = INVALID_HANDLE_VALUE;
- PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
- PrivateFile->IsValidFindBuf = FALSE;
-
- *Root = &PrivateFile->EfiFile;
-
- Status = EFI_SUCCESS;
-
-Done:
- if (EFI_ERROR (Status)) {
- if (PrivateFile) {
- if (PrivateFile->FileName) {
- FreePool (PrivateFile->FileName);
- }
-
- if (PrivateFile->FilePath) {
- FreePool (PrivateFile->FilePath);
- }
-
- FreePool (PrivateFile);
- }
- }
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemOpen (
- IN EFI_FILE *This,
- OUT EFI_FILE **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Open a file relative to the source file location.
-
-Arguments:
-
- This - A pointer to the source file location.
-
- NewHandle - Pointer to storage for the new file handle.
-
- FileName - Pointer to the file name to be opened.
-
- OpenMode - File open mode information.
-
- Attributes - File creation attributes.
-
-Returns:
-
- EFI_SUCCESS - The file was opened.
-
- EFI_NOT_FOUND - The file could not be found in the volume.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_WRITE_PROTECTED - The volume or file is write protected.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
-
- EFI_VOLUME_FULL - There is not enough space left to create the new file.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_FILE *Root;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- WIN_NT_EFI_FILE_PRIVATE *NewPrivateFile;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- EFI_STATUS Status;
- CHAR16 *RealFileName;
- CHAR16 *TempFileName;
- CHAR16 *ParseFileName;
- CHAR16 *GuardPointer;
- CHAR16 TempChar;
- DWORD LastError;
- UINTN Count;
- BOOLEAN LoopFinish;
- UINTN InfoSize;
- EFI_FILE_INFO *Info;
-
- //
- // Check for obvious invalid parameters.
- //
- if (This == NULL || NewHandle == NULL || FileName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (OpenMode) {
- case EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:
- if (Attributes &~EFI_FILE_VALID_ATTR) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Attributes & EFI_FILE_READ_ONLY) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // fall through
- //
- case EFI_FILE_MODE_READ:
- case EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Init local variables
- //
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
- NewPrivateFile = NULL;
-
- //
- // Allocate buffer for FileName as the passed in FileName may be read only
- //
- TempFileName = AllocatePool (StrSize (FileName));
- if (TempFileName == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- StrCpy (TempFileName, FileName);
- FileName = TempFileName;
-
- //
- // BUGBUG: assume an open of root
- // if current location, return current data
- //
- if (StrCmp (FileName, L"\\") == 0 || (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) {
- //
- // BUGBUG: assume an open root
- //
-OpenRoot:
- Status = WinNtSimpleFileSystemOpenVolume (PrivateFile->SimpleFileSystem, &Root);
- NewPrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (Root);
- goto Done;
- }
-
- if (FileName[StrLen (FileName) - 1] == L'\\') {
- FileName[StrLen (FileName) - 1] = 0;
- }
-
- //
- // 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) {
- //
- // Trim leading blanks
- //
- Count = 0;
- for (TempFileName = FileName;
- *TempFileName != 0 && *TempFileName == L' ';
- TempFileName++) {
- Count++;
- }
- CutPrefix (FileName, Count);
- //
- // Trim trailing dots and blanks
- //
- for (TempFileName = FileName + StrLen (FileName) - 1;
- TempFileName >= FileName && (*TempFileName == L' ' || *TempFileName == L'.');
- TempFileName--) {
- ;
- }
- *(TempFileName + 1) = 0;
- }
-
- //
- // Attempt to open the file
- //
- 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 = AllocatePool (StrSize (PrivateFile->FileName));
- if (NewPrivateFile->FilePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- if (PrivateFile->IsDirectoryPath) {
- StrCpy (NewPrivateFile->FilePath, PrivateFile->FileName);
- } else {
- StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath);
- }
-
- NewPrivateFile->FileName = AllocatePool (StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName));
- if (NewPrivateFile->FileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- if (*FileName == L'\\') {
- StrCpy (NewPrivateFile->FileName, PrivateRoot->FilePath);
- StrCat (NewPrivateFile->FileName, L"\\");
- StrCat (NewPrivateFile->FileName, FileName + 1);
- } else {
- StrCpy (NewPrivateFile->FileName, NewPrivateFile->FilePath);
- 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);
- }
- }
-
- //
- // Get rid of . and .., except leading . or ..
- //
-
- //
- // GuardPointer protect simplefilesystem root path not be destroyed
- //
- GuardPointer = NewPrivateFile->FileName + StrLen (PrivateRoot->FilePath);
-
- LoopFinish = FALSE;
-
- while (!LoopFinish) {
-
- LoopFinish = TRUE;
-
- for (ParseFileName = GuardPointer; *ParseFileName; ParseFileName++) {
- if (*ParseFileName == L'.' &&
- (*(ParseFileName + 1) == 0 || *(ParseFileName + 1) == L'\\') &&
- *(ParseFileName - 1) == L'\\'
- ) {
-
- //
- // cut \.
- //
- CutPrefix (ParseFileName - 1, 2);
- LoopFinish = FALSE;
- break;
- }
-
- if (*ParseFileName == L'.' &&
- *(ParseFileName + 1) == L'.' &&
- (*(ParseFileName + 2) == 0 || *(ParseFileName + 2) == L'\\') &&
- *(ParseFileName - 1) == L'\\'
- ) {
-
- ParseFileName--;
- Count = 3;
-
- while (ParseFileName != GuardPointer) {
- ParseFileName--;
- Count++;
- if (*ParseFileName == L'\\') {
- break;
- }
- }
-
- //
- // cut \.. and its left directory
- //
- CutPrefix (ParseFileName, Count);
- LoopFinish = FALSE;
- break;
- }
- }
- }
-
- if (StrCmp (NewPrivateFile->FileName, PrivateRoot->FilePath) == 0) {
- NewPrivateFile->IsRootDirectory = TRUE;
- FreePool (NewPrivateFile->FilePath);
- FreePool (NewPrivateFile->FileName);
- FreePool (NewPrivateFile);
- goto OpenRoot;
- }
-
- RealFileName = NewPrivateFile->FileName;
- while (EfiStrChr (RealFileName, L'\\') != NULL) {
- RealFileName = EfiStrChr (RealFileName, L'\\') + 1;
- }
-
- TempChar = *(RealFileName - 1);
- *(RealFileName - 1) = 0;
-
- FreePool (NewPrivateFile->FilePath);
- NewPrivateFile->FilePath = NULL;
- NewPrivateFile->FilePath = AllocatePool (StrSize (NewPrivateFile->FileName));
- if (NewPrivateFile->FilePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (NewPrivateFile->FilePath, NewPrivateFile->FileName);
-
- *(RealFileName - 1) = TempChar;
-
- NewPrivateFile->IsRootDirectory = FALSE;
-
- //
- // Test whether file or directory
- //
- if (OpenMode & EFI_FILE_MODE_CREATE) {
- if (Attributes & EFI_FILE_DIRECTORY) {
- NewPrivateFile->IsDirectoryPath = TRUE;
- } else {
- NewPrivateFile->IsDirectoryPath = FALSE;
- }
- } else {
- NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;
- NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (
- NewPrivateFile->FileName,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
-
- if (NewPrivateFile->LHandle != INVALID_HANDLE_VALUE) {
- NewPrivateFile->IsDirectoryPath = FALSE;
- NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->LHandle);
- } else {
- NewPrivateFile->IsDirectoryPath = TRUE;
- }
-
- NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;
- }
-
- if (OpenMode & EFI_FILE_MODE_WRITE) {
- NewPrivateFile->IsOpenedByRead = FALSE;
- } else {
- NewPrivateFile->IsOpenedByRead = TRUE;
- }
-
- Status = EFI_SUCCESS;
-
- //
- // deal with directory
- //
- if (NewPrivateFile->IsDirectoryPath) {
-
- TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*"));
- if (TempFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (TempFileName, NewPrivateFile->FileName);
-
- if ((OpenMode & EFI_FILE_MODE_CREATE)) {
- //
- // Create a directory
- //
- if (!NewPrivateFile->WinNtThunk->CreateDirectory (TempFileName, NULL)) {
-
- LastError = PrivateFile->WinNtThunk->GetLastError ();
- if (LastError != ERROR_ALREADY_EXISTS) {
- FreePool (TempFileName);
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- }
- }
-
- NewPrivateFile->DirHandle = NewPrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- NewPrivateFile->IsOpenedByRead ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE),
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
- );
-
- if (NewPrivateFile->DirHandle == INVALID_HANDLE_VALUE) {
-
- NewPrivateFile->DirHandle = NewPrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
- );
-
- if (NewPrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
- NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->DirHandle);
- NewPrivateFile->DirHandle = INVALID_HANDLE_VALUE;
- Status = EFI_ACCESS_DENIED;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
- goto Done;
- }
-
- //
- // Find the first file under it
- //
- StrCat (TempFileName, L"\\*");
- NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->FindFirstFile (TempFileName, &NewPrivateFile->FindBuf);
-
- if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- NewPrivateFile->IsValidFindBuf = FALSE;
- } else {
- NewPrivateFile->IsValidFindBuf = TRUE;
- }
- } else {
- //
- // deal with file
- //
- if (!NewPrivateFile->IsOpenedByRead) {
- NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (
- NewPrivateFile->FileName,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- (OpenMode & EFI_FILE_MODE_CREATE) ? OPEN_ALWAYS : OPEN_EXISTING,
- 0,
- NULL
- );
-
- if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (
- NewPrivateFile->FileName,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
-
- if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_NOT_FOUND;
- } else {
- Status = EFI_ACCESS_DENIED;
- NewPrivateFile->WinNtThunk->CloseHandle (NewPrivateFile->LHandle);
- NewPrivateFile->LHandle = INVALID_HANDLE_VALUE;
- }
- }
- } else {
- NewPrivateFile->LHandle = NewPrivateFile->WinNtThunk->CreateFile (
- NewPrivateFile->FileName,
- GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
-
- if (NewPrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_NOT_FOUND;
- }
- }
- }
-
- if ((OpenMode & EFI_FILE_MODE_CREATE) && Status == EFI_SUCCESS) {
- //
- // Set the attribute
- //
- InfoSize = 0;
- Info = NULL;
-
- Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
-
- if (Status != EFI_BUFFER_TOO_SMALL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Info = AllocatePool (InfoSize);
- if (Info == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Status = WinNtSimpleFileSystemGetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, &InfoSize, Info);
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Info->Attribute = Attributes;
-
- WinNtSimpleFileSystemSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info);
- }
-
-Done: ;
- FreePool (FileName);
-
- if (EFI_ERROR (Status)) {
- if (NewPrivateFile) {
- if (NewPrivateFile->FileName) {
- FreePool (NewPrivateFile->FileName);
- }
-
- if (NewPrivateFile->FilePath) {
- FreePool (NewPrivateFile->FilePath);
- }
-
- FreePool (NewPrivateFile);
- }
- } else {
- *NewHandle = &NewPrivateFile->EfiFile;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemClose (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Close the specified file handle.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle has been closed.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
- if (PrivateFile->IsDirectoryPath) {
- PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);
- } else {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);
- }
-
- PrivateFile->LHandle = INVALID_HANDLE_VALUE;
- }
-
- if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);
- PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
- }
-
- if (PrivateFile->FileName) {
- FreePool (PrivateFile->FileName);
- }
-
- FreePool (PrivateFile);
-
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDelete (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Close and delete a file.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle was closed and deleted.
-
- EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- Status = EFI_WARN_DELETE_FAILURE;
-
- if (PrivateFile->IsDirectoryPath) {
- if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
- PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);
- }
-
- if (PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);
- PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
- }
-
- if (PrivateFile->WinNtThunk->RemoveDirectory (PrivateFile->FileName)) {
- Status = EFI_SUCCESS;
- }
- } else {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);
- PrivateFile->LHandle = INVALID_HANDLE_VALUE;
-
- if (!PrivateFile->IsOpenedByRead) {
- if (PrivateFile->WinNtThunk->DeleteFile (PrivateFile->FileName)) {
- Status = EFI_SUCCESS;
- }
- }
- }
-
- FreePool (PrivateFile->FileName);
- FreePool (PrivateFile);
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-STATIC
-VOID
-WinNtSystemTimeToEfiTime (
- IN SYSTEMTIME *SystemTime,
- IN TIME_ZONE_INFORMATION *TimeZone,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SystemTime - TODO: add argument description
- TimeZone - TODO: add argument description
- Time - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- Time->Year = (UINT16) SystemTime->wYear;
- Time->Month = (UINT8) SystemTime->wMonth;
- Time->Day = (UINT8) SystemTime->wDay;
- Time->Hour = (UINT8) SystemTime->wHour;
- Time->Minute = (UINT8) SystemTime->wMinute;
- Time->Second = (UINT8) SystemTime->wSecond;
- Time->Nanosecond = (UINT32) SystemTime->wMilliseconds * 1000000;
- Time->TimeZone = (INT16) TimeZone->Bias;
-
- if (TimeZone->StandardDate.wMonth) {
- Time->Daylight = EFI_TIME_ADJUST_DAYLIGHT;
- }
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemRead (
- IN EFI_FILE *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read data from a file.
-
-Arguments:
-
- This - Pointer to a returned open file handle.
-
- BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
-
- Buffer - Pointer to the first byte of the read Buffer.
-
-Returns:
-
- EFI_SUCCESS - The data was read.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
- *BufferSize has been updated with the size needed to complete the request.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- UINTN Index;
- SYSTEMTIME SystemTime;
- EFI_FILE_INFO *Info;
- WCHAR *pw;
- TIME_ZONE_INFORMATION TimeZone;
- EFI_FILE_INFO *FileInfo;
- UINT64 Pos;
- UINT64 FileSize;
- UINTN FileInfoSize;
- EFI_TPL OldTpl;
-
- if (This == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (!PrivateFile->IsDirectoryPath) {
-
- if (This->GetPosition (This, &Pos) != EFI_SUCCESS) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- FileInfoSize = SIZE_OF_EFI_FILE_SYSTEM_INFO;
- FileInfo = AllocatePool (FileInfoSize);
-
- Status = This->GetInfo (
- This,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- FreePool (FileInfo);
- FileInfo = AllocatePool (FileInfoSize);
- Status = This->GetInfo (
- This,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo
- );
- }
-
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- FileSize = FileInfo->FileSize;
-
- FreePool (FileInfo);
-
- if (Pos >= FileSize) {
- *BufferSize = 0;
- if (Pos == FileSize) {
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- }
-
- Status = PrivateFile->WinNtThunk->ReadFile (
- PrivateFile->LHandle,
- Buffer,
- *BufferSize,
- BufferSize,
- NULL
- ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
- goto Done;
- }
-
- //
- // Read on a directory. Perform a find next
- //
- if (!PrivateFile->IsValidFindBuf) {
- *BufferSize = 0;
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- Size = SIZE_OF_EFI_FILE_INFO;
-
- NameSize = StrSize (PrivateFile->FindBuf.cFileName);
-
- ResultSize = Size + NameSize;
-
- Status = EFI_BUFFER_TOO_SMALL;
-
- if (*BufferSize >= ResultSize) {
- Status = EFI_SUCCESS;
-
- Info = Buffer;
- ZeroMem (Info, ResultSize);
-
- Info->Size = ResultSize;
-
- PrivateFile->WinNtThunk->GetTimeZoneInformation (&TimeZone);
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime (
- &PrivateFile->FindBuf.ftCreationTime,
- &PrivateFile->FindBuf.ftCreationTime
- );
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftCreationTime, &SystemTime);
-
- WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->CreateTime);
-
- PrivateFile->WinNtThunk->FileTimeToLocalFileTime (
- &PrivateFile->FindBuf.ftLastWriteTime,
- &PrivateFile->FindBuf.ftLastWriteTime
- );
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&PrivateFile->FindBuf.ftLastWriteTime, &SystemTime);
-
- WinNtSystemTimeToEfiTime (&SystemTime, &TimeZone, &Info->ModificationTime);
-
- Info->FileSize = PrivateFile->FindBuf.nFileSizeLow;
-
- Info->PhysicalSize = PrivateFile->FindBuf.nFileSizeLow;
-
- if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {
- Info->Attribute |= EFI_FILE_ARCHIVE;
- }
-
- if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {
- Info->Attribute |= EFI_FILE_HIDDEN;
- }
-
- if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) {
- Info->Attribute |= EFI_FILE_SYSTEM;
- }
-
- if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- Info->Attribute |= EFI_FILE_READ_ONLY;
- }
-
- if (PrivateFile->FindBuf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- Info->Attribute |= EFI_FILE_DIRECTORY;
- }
-
- NameSize = NameSize / sizeof (WCHAR);
-
- pw = (WCHAR *) (((CHAR8 *) Buffer) + Size);
-
- for (Index = 0; Index < NameSize; Index++) {
- pw[Index] = PrivateFile->FindBuf.cFileName[Index];
- }
-
- if (PrivateFile->WinNtThunk->FindNextFile (PrivateFile->LHandle, &PrivateFile->FindBuf)) {
- PrivateFile->IsValidFindBuf = TRUE;
- } else {
- PrivateFile->IsValidFindBuf = FALSE;
- }
- }
-
- *BufferSize = ResultSize;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemWrite (
- IN EFI_FILE *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Write data to a file.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
- of data written to the file.
-
- Buffer - Pointer to the first by of data in the buffer to write to the file.
-
-Returns:
-
- EFI_SUCCESS - The data was written to the file.
-
- EFI_UNSUPPORTED - Writes to an open directory are not supported.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- if (This == NULL || BufferSize == NULL || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (PrivateFile->IsOpenedByRead) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- Status = PrivateFile->WinNtThunk->WriteFile (
- PrivateFile->LHandle,
- Buffer,
- *BufferSize,
- BufferSize,
- NULL
- ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-
- //
- // bugbug: need to access windows error reporting
- //
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemSetPosition (
- IN EFI_FILE *This,
- IN UINT64 Position
- )
-/*++
-
-Routine Description:
-
- Set a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - The byte position from the start of the file to set.
-
-Returns:
-
- EFI_SUCCESS - The file position has been changed.
-
- EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- UINT32 PosLow;
- UINT32 PosHigh;
- CHAR16 *FileName;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->IsDirectoryPath) {
- if (Position != 0) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*"));
- if (FileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (FileName, PrivateFile->FileName);
- StrCat (FileName, L"\\*");
-
- if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
- PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);
- }
-
- PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (FileName, &PrivateFile->FindBuf);
-
- if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- PrivateFile->IsValidFindBuf = FALSE;
- } else {
- PrivateFile->IsValidFindBuf = TRUE;
- }
-
- FreePool (FileName);
-
- Status = (PrivateFile->LHandle == INVALID_HANDLE_VALUE) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
- } else {
- if (Position == (UINT64) -1) {
- PosLow = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) 0, NULL, FILE_END);
- } else {
- PosHigh = (UINT32) RShiftU64 (Position, 32);
-
- PosLow = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) Position, &PosHigh, FILE_BEGIN);
- }
-
- Status = (PosLow == 0xFFFFFFFF) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemGetPosition (
- IN EFI_FILE *This,
- OUT UINT64 *Position
- )
-/*++
-
-Routine Description:
-
- Get a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - Pointer to storage for the current position.
-
-Returns:
-
- EFI_SUCCESS - The file position has been reported.
-
- EFI_UNSUPPORTED - Not valid for directories.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- INT32 PositionHigh;
- UINT64 PosHigh64;
- EFI_TPL OldTpl;
-
- if (This == NULL || Position == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- PositionHigh = 0;
- PosHigh64 = 0;
-
- if (PrivateFile->IsDirectoryPath) {
-
- Status = EFI_UNSUPPORTED;
- goto Done;
-
- } else {
-
- PositionHigh = 0;
- *Position = PrivateFile->WinNtThunk->SetFilePointer (
- PrivateFile->LHandle,
- 0,
- &PositionHigh,
- FILE_CURRENT
- );
-
- Status = *Position == 0xffffffff ? EFI_DEVICE_ERROR : EFI_SUCCESS;
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- PosHigh64 = PositionHigh;
- *Position += LShiftU64 (PosHigh64, 32);
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-WinNtSimpleFileSystemFileInfo (
- IN WIN_NT_EFI_FILE_PRIVATE *PrivateFile,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PrivateFile - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN NameSize;
- UINTN ResultSize;
- EFI_FILE_INFO *Info;
- BY_HANDLE_FILE_INFORMATION FileInfo;
- SYSTEMTIME SystemTime;
- CHAR16 *RealFileName;
- CHAR16 *TempPointer;
- EFI_FILE_INFO *DirInfo;
- UINTN ReadSize;
- UINT64 Location;
- EFI_STATUS DirStatus;
-
-
- Size = SIZE_OF_EFI_FILE_INFO;
- NameSize = StrSize (PrivateFile->FileName);
- ResultSize = Size + NameSize;
-
- Status = EFI_BUFFER_TOO_SMALL;
- if (*BufferSize >= ResultSize) {
- Status = EFI_SUCCESS;
-
- Info = Buffer;
- ZeroMem (Info, ResultSize);
-
- Info->Size = ResultSize;
- PrivateFile->WinNtThunk->GetFileInformationByHandle (
- PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,
- &FileInfo
- );
- Info->FileSize = FileInfo.nFileSizeLow;
- Info->PhysicalSize = Info->FileSize;
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftCreationTime, &SystemTime);
- Info->CreateTime.Year = SystemTime.wYear;
- Info->CreateTime.Month = (UINT8) SystemTime.wMonth;
- Info->CreateTime.Day = (UINT8) SystemTime.wDay;
- Info->CreateTime.Hour = (UINT8) SystemTime.wHour;
- Info->CreateTime.Minute = (UINT8) SystemTime.wMinute;
- Info->CreateTime.Second = (UINT8) SystemTime.wSecond;
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastAccessTime, &SystemTime);
- Info->LastAccessTime.Year = SystemTime.wYear;
- Info->LastAccessTime.Month = (UINT8) SystemTime.wMonth;
- Info->LastAccessTime.Day = (UINT8) SystemTime.wDay;
- Info->LastAccessTime.Hour = (UINT8) SystemTime.wHour;
- Info->LastAccessTime.Minute = (UINT8) SystemTime.wMinute;
- Info->LastAccessTime.Second = (UINT8) SystemTime.wSecond;
-
- PrivateFile->WinNtThunk->FileTimeToSystemTime (&FileInfo.ftLastWriteTime, &SystemTime);
- Info->ModificationTime.Year = SystemTime.wYear;
- Info->ModificationTime.Month = (UINT8) SystemTime.wMonth;
- Info->ModificationTime.Day = (UINT8) SystemTime.wDay;
- Info->ModificationTime.Hour = (UINT8) SystemTime.wHour;
- Info->ModificationTime.Minute = (UINT8) SystemTime.wMinute;
- Info->ModificationTime.Second = (UINT8) SystemTime.wSecond;
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) {
- Info->Attribute |= EFI_FILE_ARCHIVE;
- }
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {
- Info->Attribute |= EFI_FILE_HIDDEN;
- }
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- Info->Attribute |= EFI_FILE_READ_ONLY;
- }
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) {
- Info->Attribute |= EFI_FILE_SYSTEM;
- }
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- Info->Attribute |= EFI_FILE_DIRECTORY;
- }
-
- if (PrivateFile->IsDirectoryPath) {
- Info->Attribute |= EFI_FILE_DIRECTORY;
- }
-
- RealFileName = PrivateFile->FileName;
- TempPointer = RealFileName;
-
- while (*TempPointer) {
- if (*TempPointer == '\\') {
- RealFileName = TempPointer + 1;
- }
-
- TempPointer++;
- }
-
- if (PrivateFile->IsRootDirectory) {
- *((CHAR8 *) Buffer + Size) = 0;
- } else {
- CopyMem ((CHAR8 *) Buffer + Size, RealFileName, NameSize);
- }
-
- if (Info->Attribute & EFI_FILE_DIRECTORY) {
- //
- // The GetFileInformationByHandle.nFileSizeLow is bogus for dir so we
- // need to do the same thing the caller would do to get the right value
- //
- ASSERT (PrivateFile->EfiFile.Read != NULL);
- DirStatus = PrivateFile->EfiFile.GetPosition (&PrivateFile->EfiFile, &Location);
- if (EFI_ERROR (DirStatus)) {
- Location = 0;
- }
-
- PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, 0);
- Info->FileSize = 0;
- do {
- ReadSize = 0;
- DirInfo = NULL;
- DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);
- if (DirStatus == EFI_BUFFER_TOO_SMALL) {
- DirInfo = AllocatePool (ReadSize);
- if (DirInfo != NULL) {
- //
- // Read each dir entry to figure out how big the directory is
- //
- DirStatus = PrivateFile->EfiFile.Read (&PrivateFile->EfiFile, &ReadSize, DirInfo);
- if (!EFI_ERROR (DirStatus) && (ReadSize != 0)) {
- Info->FileSize += ReadSize;
- }
- FreePool (DirInfo);
- }
- }
-
- } while (!EFI_ERROR (DirStatus) && (ReadSize != 0));
-
- //
- // reset the file possition back to the previous location
- //
- PrivateFile->EfiFile.SetPosition (&PrivateFile->EfiFile, Location);
- }
- }
-
- *BufferSize = ResultSize;
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemGetInfo (
- IN EFI_FILE *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Return information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID describing the type of information to be returned.
-
- BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
- information buffer.
-
- Buffer - Pointer to the first byte of the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The requested information has been written into the buffer.
-
- EFI_UNSUPPORTED - The InformationType is not known.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
- been updated with the size needed to complete the requested operation.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_SYSTEM_INFO *FileSystemInfoBuffer;
- UINT32 SectorsPerCluster;
- UINT32 BytesPerSector;
- UINT32 FreeClusters;
- UINT32 TotalClusters;
- UINT32 BytesPerCluster;
- CHAR16 *DriveName;
- BOOLEAN DriveNameFound;
- BOOL NtStatus;
- UINTN Index;
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- EFI_TPL OldTpl;
-
- if (This == NULL || InformationType == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
-
- Status = EFI_UNSUPPORTED;
-
- if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
- Status = WinNtSimpleFileSystemFileInfo (PrivateFile, BufferSize, Buffer);
- }
-
- if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
- if (*BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {
- *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
- FileSystemInfoBuffer = (EFI_FILE_SYSTEM_INFO *) Buffer;
- FileSystemInfoBuffer->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- FileSystemInfoBuffer->ReadOnly = FALSE;
-
- //
- // Try to get the drive name
- //
- DriveNameFound = FALSE;
- DriveName = AllocatePool (StrSize (PrivateFile->FilePath) + 1);
- if (DriveName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (DriveName, PrivateFile->FilePath);
- for (Index = 0; DriveName[Index] != 0 && DriveName[Index] != ':'; Index++) {
- ;
- }
-
- if (DriveName[Index] == ':') {
- DriveName[Index + 1] = '\\';
- DriveName[Index + 2] = 0;
- DriveNameFound = TRUE;
- } else if (DriveName[0] == '\\' && DriveName[1] == '\\') {
- for (Index = 2; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
- ;
- }
-
- if (DriveName[Index] == '\\') {
- DriveNameFound = TRUE;
- for (Index++; DriveName[Index] != 0 && DriveName[Index] != '\\'; Index++) {
- ;
- }
-
- DriveName[Index] = '\\';
- DriveName[Index + 1] = 0;
- }
- }
-
- //
- // Try GetDiskFreeSpace first
- //
- NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpace (
- DriveNameFound ? DriveName : NULL,
- &SectorsPerCluster,
- &BytesPerSector,
- &FreeClusters,
- &TotalClusters
- );
- if (DriveName) {
- FreePool (DriveName);
- }
-
- if (NtStatus) {
- //
- // Succeeded
- //
- BytesPerCluster = BytesPerSector * SectorsPerCluster;
- FileSystemInfoBuffer->VolumeSize = MultU64x32 (TotalClusters, BytesPerCluster);
- FileSystemInfoBuffer->FreeSpace = MultU64x32 (FreeClusters, BytesPerCluster);
- FileSystemInfoBuffer->BlockSize = BytesPerCluster;
-
- } else {
- //
- // try GetDiskFreeSpaceEx then
- //
- FileSystemInfoBuffer->BlockSize = 0;
- NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpaceEx (
- PrivateFile->FilePath,
- (PULARGE_INTEGER) (&FileSystemInfoBuffer->FreeSpace),
- (PULARGE_INTEGER) (&FileSystemInfoBuffer->VolumeSize),
- NULL
- );
- if (!NtStatus) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- }
-
- StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel);
- *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_SUCCESS;
- }
-
- if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
- StrCpy ((CHAR16 *) Buffer, PrivateRoot->VolumeLabel);
- *BufferSize = StrSize (PrivateRoot->VolumeLabel);
- Status = EFI_SUCCESS;
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemSetInfo (
- IN EFI_FILE *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Set information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID identifying the type of information to set.
-
- BufferSize - Number of bytes of data in the information buffer.
-
- Buffer - Pointer to the first byte of data in the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The file or volume information has been updated.
-
- EFI_UNSUPPORTED - The information identifier is not recognised.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
- EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *PrivateRoot;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_FILE_INFO *OldFileInfo;
- EFI_FILE_INFO *NewFileInfo;
- EFI_STATUS Status;
- UINTN OldInfoSize;
- INTN NtStatus;
- UINT32 NewAttr;
- UINT32 OldAttr;
- CHAR16 *OldFileName;
- CHAR16 *NewFileName;
- CHAR16 *TempFileName;
- CHAR16 *CharPointer;
- BOOLEAN AttrChangeFlag;
- BOOLEAN NameChangeFlag;
- BOOLEAN SizeChangeFlag;
- BOOLEAN TimeChangeFlag;
- UINT64 CurPos;
- SYSTEMTIME NewCreationSystemTime;
- SYSTEMTIME NewLastAccessSystemTime;
- SYSTEMTIME NewLastWriteSystemTime;
- FILETIME NewCreationFileTime;
- FILETIME NewLastAccessFileTime;
- FILETIME NewLastWriteFileTime;
- WIN32_FIND_DATA FindBuf;
- EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
- EFI_TPL OldTpl;
-
- //
- // Check for invalid parameters.
- //
- if (This == NULL || InformationType == NULL || BufferSize == 0 || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- //
- // Initialise locals.
- //
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
- PrivateRoot = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem);
-
- Status = EFI_UNSUPPORTED;
- OldFileInfo = NewFileInfo = NULL;
- OldFileName = NewFileName = NULL;
- AttrChangeFlag = NameChangeFlag = SizeChangeFlag = TimeChangeFlag = FALSE;
-
- //
- // Set file system information.
- //
- if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
- if (BufferSize < SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel)) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- NewFileSystemInfo = (EFI_FILE_SYSTEM_INFO *) Buffer;
-
- FreePool (PrivateRoot->VolumeLabel);
- PrivateRoot->VolumeLabel = AllocatePool (StrSize (NewFileSystemInfo->VolumeLabel));
- if (PrivateRoot->VolumeLabel == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (PrivateRoot->VolumeLabel, NewFileSystemInfo->VolumeLabel);
-
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Set volume label information.
- //
- if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
- if (BufferSize < StrSize (PrivateRoot->VolumeLabel)) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- StrCpy (PrivateRoot->VolumeLabel, (CHAR16 *) Buffer);
-
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- if (!CompareGuid (InformationType, &gEfiFileInfoGuid)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (BufferSize < SIZE_OF_EFI_FILE_INFO) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- //
- // Set file/directory information.
- //
-
- //
- // Check for invalid set file information parameters.
- //
- NewFileInfo = (EFI_FILE_INFO *) Buffer;
-
- if (NewFileInfo->Size <= sizeof (EFI_FILE_INFO) ||
- (NewFileInfo->Attribute &~(EFI_FILE_VALID_ATTR)) ||
- (sizeof (UINTN) == 4 && NewFileInfo->Size > 0xFFFFFFFF)
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // bugbug: - This is not safe. We need something like EfiStrMaxSize()
- // that would have an additional parameter that would be the size
- // of the string array just in case there are no NULL characters in
- // the string array.
- //
- //
- // Get current file information so we can determine what kind
- // of change request this is.
- //
- OldInfoSize = 0;
- Status = WinNtSimpleFileSystemFileInfo (PrivateFile, &OldInfoSize, NULL);
-
- if (Status != EFI_BUFFER_TOO_SMALL) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- OldFileInfo = AllocatePool (OldInfoSize);
- if (OldFileInfo == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Status = WinNtSimpleFileSystemFileInfo (PrivateFile, &OldInfoSize, OldFileInfo);
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- OldFileName = AllocatePool (StrSize (PrivateFile->FileName));
- if (OldFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (OldFileName, PrivateFile->FileName);
-
- //
- // Make full pathname from new filename and rootpath.
- //
- if (NewFileInfo->FileName[0] == '\\') {
- NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));
- if (NewFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (NewFileName, PrivateRoot->FilePath);
- StrCat (NewFileName, L"\\");
- StrCat (NewFileName, NewFileInfo->FileName + 1);
- } else {
- NewFileName = AllocatePool (StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName));
- if (NewFileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (NewFileName, PrivateFile->FilePath);
- StrCat (NewFileName, L"\\");
- StrCat (NewFileName, NewFileInfo->FileName);
- }
-
- //
- // Is there an attribute change request?
- //
- if (NewFileInfo->Attribute != OldFileInfo->Attribute) {
- if ((NewFileInfo->Attribute & EFI_FILE_DIRECTORY) != (OldFileInfo->Attribute & EFI_FILE_DIRECTORY)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- AttrChangeFlag = TRUE;
- }
-
- //
- // Is there a name change request?
- // bugbug: - Need EfiStrCaseCmp()
- //
- if (StrCmp (NewFileInfo->FileName, OldFileInfo->FileName)) {
- NameChangeFlag = TRUE;
- }
-
- //
- // Is there a size change request?
- //
- if (NewFileInfo->FileSize != OldFileInfo->FileSize) {
- SizeChangeFlag = TRUE;
- }
-
- //
- // Is there a time stamp change request?
- //
- if (!IsZero (&NewFileInfo->CreateTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->CreateTime, &OldFileInfo->CreateTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- } else if (!IsZero (&NewFileInfo->LastAccessTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->LastAccessTime, &OldFileInfo->LastAccessTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- } else if (!IsZero (&NewFileInfo->ModificationTime, sizeof (EFI_TIME)) &&
- CompareMem (&NewFileInfo->ModificationTime, &OldFileInfo->ModificationTime, sizeof (EFI_TIME))
- ) {
- TimeChangeFlag = TRUE;
- }
-
- //
- // All done if there are no change requests being made.
- //
- if (!(AttrChangeFlag || NameChangeFlag || SizeChangeFlag || TimeChangeFlag)) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Set file or directory information.
- //
- OldAttr = PrivateFile->WinNtThunk->GetFileAttributes (OldFileName);
-
- //
- // Name change.
- //
- if (NameChangeFlag) {
- //
- // Close the handles first
- //
- if (PrivateFile->IsOpenedByRead) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- for (CharPointer = NewFileName; *CharPointer != 0 && *CharPointer != L'/'; CharPointer++) {
- }
-
- if (*CharPointer != 0) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- if (PrivateFile->LHandle != INVALID_HANDLE_VALUE) {
- if (PrivateFile->IsDirectoryPath) {
- PrivateFile->WinNtThunk->FindClose (PrivateFile->LHandle);
- } else {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->LHandle);
- PrivateFile->LHandle = INVALID_HANDLE_VALUE;
- }
- }
-
- if (PrivateFile->IsDirectoryPath && PrivateFile->DirHandle != INVALID_HANDLE_VALUE) {
- PrivateFile->WinNtThunk->CloseHandle (PrivateFile->DirHandle);
- PrivateFile->DirHandle = INVALID_HANDLE_VALUE;
- }
-
- NtStatus = PrivateFile->WinNtThunk->MoveFile (OldFileName, NewFileName);
-
- if (NtStatus) {
- //
- // modify file name
- //
- FreePool (PrivateFile->FileName);
-
- PrivateFile->FileName = AllocatePool (StrSize (NewFileName));
- if (PrivateFile->FileName == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- StrCpy (PrivateFile->FileName, NewFileName);
-
- TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*"));
-
- StrCpy (TempFileName, NewFileName);
-
- if (!PrivateFile->IsDirectoryPath) {
- PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
-
- FreePool (TempFileName);
-
- //
- // Flush buffers just in case
- //
- if (PrivateFile->WinNtThunk->FlushFileBuffers (PrivateFile->LHandle) == 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- } else {
- PrivateFile->DirHandle = PrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
- );
-
- StrCat (TempFileName, L"\\*");
- PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);
-
- FreePool (TempFileName);
- }
- } else {
-Reopen: ;
- Status = EFI_DEVICE_ERROR;
-
- NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (OldFileName, OldAttr);
-
- if (!NtStatus) {
- goto Done;
- }
-
- TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*"));
-
- StrCpy (TempFileName, OldFileName);
-
- if (!PrivateFile->IsDirectoryPath) {
- PrivateFile->LHandle = PrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- 0,
- NULL
- );
- } else {
- PrivateFile->DirHandle = PrivateFile->WinNtThunk->CreateFile (
- TempFileName,
- PrivateFile->IsOpenedByRead ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL,
- OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS,
- NULL
- );
-
- StrCat (TempFileName, L"\\*");
- PrivateFile->LHandle = PrivateFile->WinNtThunk->FindFirstFile (TempFileName, &FindBuf);
- }
-
- FreePool (TempFileName);
-
- goto Done;
-
- }
- }
-
- //
- // Size change
- //
- if (SizeChangeFlag) {
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (PrivateFile->IsOpenedByRead || OldFileInfo->Attribute & EFI_FILE_READ_ONLY) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- Status = This->GetPosition (This, &CurPos);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = This->SetPosition (This, NewFileInfo->FileSize);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (PrivateFile->WinNtThunk->SetEndOfFile (PrivateFile->LHandle) == 0) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- Status = This->SetPosition (This, CurPos);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
- //
- // Time change
- //
- if (TimeChangeFlag) {
-
- NewCreationSystemTime.wYear = NewFileInfo->CreateTime.Year;
- NewCreationSystemTime.wMonth = NewFileInfo->CreateTime.Month;
- NewCreationSystemTime.wDay = NewFileInfo->CreateTime.Day;
- NewCreationSystemTime.wHour = NewFileInfo->CreateTime.Hour;
- NewCreationSystemTime.wMinute = NewFileInfo->CreateTime.Minute;
- NewCreationSystemTime.wSecond = NewFileInfo->CreateTime.Second;
- NewCreationSystemTime.wMilliseconds = 0;
-
- if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (
- &NewCreationSystemTime,
- &NewCreationFileTime
- )) {
- goto Done;
- }
-
- NewLastAccessSystemTime.wYear = NewFileInfo->LastAccessTime.Year;
- NewLastAccessSystemTime.wMonth = NewFileInfo->LastAccessTime.Month;
- NewLastAccessSystemTime.wDay = NewFileInfo->LastAccessTime.Day;
- NewLastAccessSystemTime.wHour = NewFileInfo->LastAccessTime.Hour;
- NewLastAccessSystemTime.wMinute = NewFileInfo->LastAccessTime.Minute;
- NewLastAccessSystemTime.wSecond = NewFileInfo->LastAccessTime.Second;
- NewLastAccessSystemTime.wMilliseconds = 0;
-
- if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (
- &NewLastAccessSystemTime,
- &NewLastAccessFileTime
- )) {
- goto Done;
- }
-
- NewLastWriteSystemTime.wYear = NewFileInfo->ModificationTime.Year;
- NewLastWriteSystemTime.wMonth = NewFileInfo->ModificationTime.Month;
- NewLastWriteSystemTime.wDay = NewFileInfo->ModificationTime.Day;
- NewLastWriteSystemTime.wHour = NewFileInfo->ModificationTime.Hour;
- NewLastWriteSystemTime.wMinute = NewFileInfo->ModificationTime.Minute;
- NewLastWriteSystemTime.wSecond = NewFileInfo->ModificationTime.Second;
- NewLastWriteSystemTime.wMilliseconds = 0;
-
- if (!PrivateFile->WinNtThunk->SystemTimeToFileTime (
- &NewLastWriteSystemTime,
- &NewLastWriteFileTime
- )) {
- goto Done;
- }
-
- if (!PrivateFile->WinNtThunk->SetFileTime (
- PrivateFile->IsDirectoryPath ? PrivateFile->DirHandle : PrivateFile->LHandle,
- &NewCreationFileTime,
- &NewLastAccessFileTime,
- &NewLastWriteFileTime
- )) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- }
-
- //
- // No matter about AttrChangeFlag, Attribute must be set.
- // Because operation before may cause attribute change.
- //
- NewAttr = OldAttr;
-
- if (NewFileInfo->Attribute & EFI_FILE_ARCHIVE) {
- NewAttr |= FILE_ATTRIBUTE_ARCHIVE;
- } else {
- NewAttr &= ~FILE_ATTRIBUTE_ARCHIVE;
- }
-
- if (NewFileInfo->Attribute & EFI_FILE_HIDDEN) {
- NewAttr |= FILE_ATTRIBUTE_HIDDEN;
- } else {
- NewAttr &= ~FILE_ATTRIBUTE_HIDDEN;
- }
-
- if (NewFileInfo->Attribute & EFI_FILE_SYSTEM) {
- NewAttr |= FILE_ATTRIBUTE_SYSTEM;
- } else {
- NewAttr &= ~FILE_ATTRIBUTE_SYSTEM;
- }
-
- if (NewFileInfo->Attribute & EFI_FILE_READ_ONLY) {
- NewAttr |= FILE_ATTRIBUTE_READONLY;
- } else {
- NewAttr &= ~FILE_ATTRIBUTE_READONLY;
- }
-
- NtStatus = PrivateFile->WinNtThunk->SetFileAttributes (NewFileName, NewAttr);
-
- if (!NtStatus) {
- goto Reopen;
- }
-
-Done:
- if (OldFileInfo != NULL) {
- FreePool (OldFileInfo);
- }
-
- if (OldFileName != NULL) {
- FreePool (OldFileName);
- }
-
- if (NewFileName != NULL) {
- FreePool (NewFileName);
- }
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemFlush (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Flush all modified data to the media.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The data has been flushed.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- BY_HANDLE_FILE_INFORMATION FileInfo;
- WIN_NT_EFI_FILE_PRIVATE *PrivateFile;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- PrivateFile = WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS (This);
-
- if (PrivateFile->LHandle == INVALID_HANDLE_VALUE) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (PrivateFile->IsDirectoryPath) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- if (PrivateFile->IsOpenedByRead) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- PrivateFile->WinNtThunk->GetFileInformationByHandle (PrivateFile->LHandle, &FileInfo);
-
- if (FileInfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- Status = PrivateFile->WinNtThunk->FlushFileBuffers (PrivateFile->LHandle) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
- //
- // bugbug: - Use Windows error reporting.
- //
-}
-
-
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h
deleted file mode 100644
index eeb373d7d5..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.h
+++ /dev/null
@@ -1,587 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtSimpleFileSystem.h
-
-Abstract:
-
- Produce Simple File System abstractions for a directory 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*
- Developer Studio for them to work.
-
- * Other names and brands may be claimed as the property of others.
-
---*/
-
-#ifndef _WIN_NT_SIMPLE_FILE_SYSTEM_H_
-#define _WIN_NT_SIMPLE_FILE_SYSTEM_H_
-
-
-
-#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
- CHAR16 *FilePath;
- CHAR16 *VolumeLabel;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE;
-
-#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE, \
- SimpleFileSystem, \
- WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
- )
-
-#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'f', 's')
-
-typedef struct {
- UINTN Signature;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
- EFI_FILE EfiFile;
- HANDLE LHandle;
- HANDLE DirHandle;
- BOOLEAN IsRootDirectory;
- BOOLEAN IsDirectoryPath;
- BOOLEAN IsOpenedByRead;
- CHAR16 *FilePath;
- WCHAR *FileName;
- BOOLEAN IsValidFindBuf;
- WIN32_FIND_DATA FindBuf;
-} WIN_NT_EFI_FILE_PRIVATE;
-
-#define WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
- CR (a, \
- WIN_NT_EFI_FILE_PRIVATE, \
- EfiFile, \
- WIN_NT_EFI_FILE_PRIVATE_SIGNATURE \
- )
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName;
-
-//
-// Driver Binding protocol member functions
-//
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Check to see if the driver supports a given controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to test.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
- specified by This.
-
- EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- the driver specified by This.
-
- EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
- a different driver or an application that requires exclusive access.
-
- EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
- driver specified by This.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Starts a device controller or a bus controller.
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - EFI handle of the controller to start.
-
- RemainingDevicePath - Pointer to remaining portion of a device path.
-
-Returns:
-
- EFI_SUCCESS - The device or bus controller has been started.
-
- EFI_DEVICE_ERROR - The device could not be started due to a device failure.
-
- EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
-
- ControllerHandle - A handle to the device to be stopped.
-
- NumberOfChildren - The number of child device handles in ChildHandleBuffer.
-
- ChildHandleBuffer - An array of child device handles to be freed.
-
-Returns:
-
- EFI_SUCCESS - The device has been stopped.
-
- EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
-
---*/
-;
-
-//
-// Simple File System protocol member functions
-//
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemOpenVolume (
- IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
- OUT EFI_FILE **Root
- )
-/*++
-
-Routine Description:
-
- Open the root directory on a volume.
-
-Arguments:
-
- This - A pointer to the volume to open.
-
- Root - A pointer to storage for the returned opened file handle of the root directory.
-
-Returns:
-
- EFI_SUCCESS - The volume was opened.
-
- EFI_UNSUPPORTED - The volume does not support the requested file system type.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemOpen (
- IN EFI_FILE *This,
- OUT EFI_FILE **NewHandle,
- IN CHAR16 *FileName,
- IN UINT64 OpenMode,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Open a file relative to the source file location.
-
-Arguments:
-
- This - A pointer to the source file location.
-
- NewHandle - Pointer to storage for the new file handle.
-
- FileName - Pointer to the file name to be opened.
-
- OpenMode - File open mode information.
-
- Attributes - File creation attributes.
-
-Returns:
-
- EFI_SUCCESS - The file was opened.
-
- EFI_NOT_FOUND - The file could not be found in the volume.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_WRITE_PROTECTED - The volume or file is write protected.
-
- EFI_ACCESS_DENIED - The service denied access to the file.
-
- EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
-
- EFI_VOLUME_FULL - There is not enough space left to create the new file.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemClose (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Close the specified file handle.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle has been closed.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemDelete (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Close and delete a file.
-
-Arguments:
-
- This - Pointer to a returned opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The file handle was closed and deleted.
-
- EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemRead (
- IN EFI_FILE *This,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read data from a file.
-
-Arguments:
-
- This - Pointer to a returned open file handle.
-
- BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
-
- Buffer - Pointer to the first byte of the read Buffer.
-
-Returns:
-
- EFI_SUCCESS - The data was read.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
-
- EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
- *BufferSize has been updated with the size needed to complete the request.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemWrite (
- IN EFI_FILE *This,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Write data to a file.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
- of data written to the file.
-
- Buffer - Pointer to the first by of data in the buffer to write to the file.
-
-Returns:
-
- EFI_SUCCESS - The data was written to the file.
-
- EFI_UNSUPPORTED - Writes to an open directory are not supported.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemSetPosition (
- IN EFI_FILE *This,
- IN UINT64 Position
- )
-/*++
-
-Routine Description:
-
- Set a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - The byte position from the start of the file to set.
-
-Returns:
-
- EFI_SUCCESS - The file position has been changed.
-
- EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemGetPosition (
- IN EFI_FILE *This,
- OUT UINT64 *Position
- )
-/*++
-
-Routine Description:
-
- Get a file's current position.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- Position - Pointer to storage for the current position.
-
-Returns:
-
- EFI_SUCCESS - The file position has been reported.
-
- EFI_UNSUPPORTED - Not valid for directories.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemGetInfo (
- IN EFI_FILE *This,
- IN EFI_GUID *InformationType,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Return information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID describing the type of information to be returned.
-
- BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
- information buffer.
-
- Buffer - Pointer to the first byte of the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The requested information has been written into the buffer.
-
- EFI_UNSUPPORTED - The InformationType is not known.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
- been updated with the size needed to complete the requested operation.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemSetInfo (
- IN EFI_FILE *This,
- IN EFI_GUID *InformationType,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Set information about a file or volume.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
- InformationType - GUID identifying the type of information to set.
-
- BufferSize - Number of bytes of data in the information buffer.
-
- Buffer - Pointer to the first byte of data in the information buffer.
-
-Returns:
-
- EFI_SUCCESS - The file or volume information has been updated.
-
- EFI_UNSUPPORTED - The information identifier is not recognised.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
- EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtSimpleFileSystemFlush (
- IN EFI_FILE *This
- )
-/*++
-
-Routine Description:
-
- Flush all modified data to the media.
-
-Arguments:
-
- This - Pointer to an opened file handle.
-
-Returns:
-
- EFI_SUCCESS - The data has been flushed.
-
- EFI_NO_MEDIA - The device has no media.
-
- EFI_DEVICE_ERROR - The device reported an error.
-
- EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
-
- EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
-
- EFI_ACCESS_DENIED - The file was opened read-only.
-
- EFI_VOLUME_FULL - The volume is full.
-
---*/
-;
-
-#endif /* _WIN_NT_SIMPLE_FILE_SYSTEM_H_ */
-
-/* eof - WinNtSimpleFileSystem.h */
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
deleted file mode 100644
index c60e293be1..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtSimpleFileSystem</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>9C25E18B-76BA-43da-A132-DBB0997CEFEF</GuidValue>
- <Version>1.0</Version>
- <Abstract>Simple filesystem driver</Abstract>
- <Description>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*
- Developer Studio for them to work.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtSimpleFileSystem</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtSimpleFileSystem.h</Filename>
- <Filename>WinNtSimpleFileSystem.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtFileSystemGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiFileSystemInfoGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiFileInfoGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtSimpleFileSystemDriverBinding</DriverBinding>
- <ComponentName>gWinNtSimpleFileSystemComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c
deleted file mode 100644
index 910771964d..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/ComponentName.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "WinNtUga.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtUgaComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtUgaComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtUgaComponentName = {
- WinNtUgaComponentNameGetDriverName,
- WinNtUgaComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtUgaDriverNameTable[] = {
- { "eng", L"Windows Universal Graphics Adapter Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtUgaComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtUgaComponentName.SupportedLanguages,
- mWinNtUgaDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtUgaComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UGA_PRIVATE_DATA *Private;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtUgaDriverBinding.DriverBindingHandle,
- &gEfiWinNtIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUgaDrawProtocolGuid,
- &UgaDraw,
- gWinNtUgaDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);
-
- return LookupUnicodeString (
- Language,
- gWinNtUgaComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h
deleted file mode 100644
index defe3913fc..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtUga.h
-
-Abstract:
-
- Private data for the Uga driver that is bound to the WinNt Thunk protocol
-
---*/
-
-#ifndef _WIN_NT_UGA_H_
-#define _WIN_NT_UGA_H_
-
-
-
-#define MAX_Q 256
-
-typedef struct {
- UINTN Front;
- UINTN Rear;
- UINTN Count;
- EFI_INPUT_KEY Q[MAX_Q];
-} UGA_QUEUE_FIXED;
-
-#define WIN_NT_UGA_CLASS_NAME L"WinNtUgaWindow"
-
-#define UGA_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
- EFI_UGA_DRAW_PROTOCOL UgaDraw;
- EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleTextIn;
-
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
- //
- // UGA Private Data for GetMode ()
- //
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
-
- //
- // UGA Private Data knowing when to start hardware
- //
- BOOLEAN HardwareNeedsStarting;
-
- CHAR16 *WindowName;
- CHAR16 Buffer[160];
-
- HANDLE ThreadInited; // Semaphore
- HANDLE ThreadHandle; // Thread
- DWORD ThreadId;
-
- HWND WindowHandle;
- WNDCLASSEX WindowsClass;
-
- //
- // This screen is used to redraw the scree when windows events happen. It's
- // updated in the main thread and displayed in the windows thread.
- //
- BITMAPV4HEADER *VirtualScreenInfo;
- RGBQUAD *VirtualScreen;
-
- EFI_UGA_PIXEL *FillLine;
-
- //
- // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
- // thread removes.
- //
- CRITICAL_SECTION QCriticalSection;
- UGA_QUEUE_FIXED Queue;
-
-} UGA_PRIVATE_DATA;
-
-#define UGA_DRAW_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, UGA_PRIVATE_DATA, UgaDraw, UGA_PRIVATE_DATA_SIGNATURE)
-
-#define UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
- CR(a, UGA_PRIVATE_DATA, SimpleTextIn, UGA_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Protocol Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtUgaDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtUgaComponentName;
-
-//
-// Uga Hardware abstraction internal worker functions
-//
-EFI_STATUS
-WinNtUgaSupported (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- WinNtIo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-WinNtUgaConstructor (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-WinNtUgaDestructor (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// EFI 1.1 driver model prototypes for Win NT UGA
-//
-
-EFI_STATUS
-EFIAPI
-WinNtUgaInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UgaPrivateAddQ (
- IN UGA_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-WinNtUgaInitializeSimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-WinNtUgaDestroySimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINTN
-Atoi (
- IN CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- String - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
deleted file mode 100644
index 0024262116..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtUga</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>AB248E8D-ABE1-11d4-BD0D-0080C73C8881</GuidValue>
- <Version>1.0</Version>
- <Abstract>Uga driver</Abstract>
- <Description>UGA is short hand for Universal Graphics Abstraction protocol.
- 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.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtUga</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtUga.h</Filename>
- <Filename>WinNtUgaInput.c</Filename>
- <Filename>WinNtUgaDriver.c</Filename>
- <Filename>WinNtUgaScreen.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Events>
- <CreateEvents>
- <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="SOMETIMES_CONSUMED">
- <EventType>EVENT_GROUP_GUID</EventType>
- </EventTypes>
- </CreateEvents>
- </Events>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtUgaGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtUgaDriverBinding</DriverBinding>
- <ComponentName>gWinNtUgaComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
deleted file mode 100644
index 520856007d..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaDriver.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*++
-
-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:
-
- WinNtUgaDriver.c
-
-Abstract:
-
- This file implements the EFI 1.1 Device Driver model requirements for UGA
-
- UGA is short hand for Universal Graphics Abstraction protocol.
-
- 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.
-
---*/
-
-#include "WinNtUga.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gWinNtUgaDriverBinding = {
- WinNtUgaDriverBindingSupported,
- WinNtUgaDriverBindingStart,
- WinNtUgaDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = WinNtUgaSupported (WinNtIo);
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Allocate Private context data for SGO inteface.
- //
- Private = AllocatePool (sizeof (UGA_PRIVATE_DATA));
- if (Private == NULL) {
- goto Done;
- }
- //
- // Set up context record
- //
- Private->Signature = UGA_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Handle;
- Private->WinNtThunk = WinNtIo->WinNtThunk;
-
- Private->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gWinNtUgaComponentName.SupportedLanguages,
- &Private->ControllerNameTable,
- WinNtIo->EnvString
- );
-
- Private->WindowName = WinNtIo->EnvString;
-
- Status = WinNtUgaConstructor (Private);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Publish the Uga interface to the world
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
-
-Done:
- if (EFI_ERROR (Status)) {
-
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- if (Private != NULL) {
- //
- // On Error Free back private data
- //
- if (Private->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (Private->ControllerNameTable);
- }
-
- FreePool (Private);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtUgaDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Handle - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_NOT_STARTED - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiUgaDrawProtocolGuid,
- &UgaDraw,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // If the UGA interface does not exist the driver is not started
- //
- return EFI_NOT_STARTED;
- }
-
- //
- // Get our private context information
- //
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (UgaDraw);
-
- //
- // Remove the SGO interface from the system
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- &gEfiSimpleTextInProtocolGuid,
- &Private->SimpleTextIn,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Shutdown the hardware
- //
- Status = WinNtUgaDestructor (Private);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->CloseProtocol (
- Handle,
- &gEfiWinNtIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- //
- // Free our instance data
- //
- FreeUnicodeStringTable (Private->ControllerNameTable);
-
- FreePool (Private);
-
- }
-
- return Status;
-}
-
-UINTN
-Atoi (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Convert a unicode string to a UINTN
-
-Arguments:
-
- String - Unicode string.
-
-Returns:
-
- UINTN of the number represented by String.
-
---*/
-{
- UINTN Number;
- CHAR16 *Str;
-
- //
- // skip preceeding white space
- //
- Str = String;
- while ((*Str) && (*Str == ' ' || *Str == '"')) {
- Str++;
- }
-
- //
- // Convert ot a Number
- //
- Number = 0;
- while (*Str != '\0') {
- if ((*Str >= '0') && (*Str <= '9')) {
- Number = (Number * 10) +*Str - '0';
- } else {
- break;
- }
-
- Str++;
- }
-
- return Number;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c
deleted file mode 100644
index 2c715c663d..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaInput.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtUgaInput.c
-
-Abstract:
-
- This file produces the Simple Text In for an Uga window.
-
- This stuff is linked at the hip to the Window, since the window
- processing is done in a thread kicked off in WinNtUgaImplementation.c
-
- Since the window information is processed in an other thread we need
- a keyboard Queue to pass data about. The Simple Text In code just
- takes data off the Queue. The WinProc message loop takes keyboard input
- and places it in the Queue.
-
---*/
-
-#include "WinNtUga.h"
-
-EFI_STATUS
-UgaPrivateCreateQ (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Private->WinNtThunk->InitializeCriticalSection (&Private->QCriticalSection);
-
- Private->Queue.Front = 0;
- Private->Queue.Rear = MAX_Q - 1;
- Private->Queue.Count = 0;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaPrivateDestroyQ (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Private->Queue.Count = 0;
- Private->WinNtThunk->DeleteCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaPrivateAddQ (
- IN UGA_PRIVATE_DATA *Private,
- IN EFI_INPUT_KEY Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
- if (Private->Queue.Count == MAX_Q) {
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_NOT_READY;
- }
-
- Private->Queue.Rear = (Private->Queue.Rear + 1) % MAX_Q;
- Private->Queue.Q[Private->Queue.Rear] = Key;
- Private->Queue.Count++;
-
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaPrivateDeleteQ (
- IN UGA_PRIVATE_DATA *Private,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
-
- if (Private->Queue.Count == 0) {
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_NOT_READY;
- }
-
- *Key = Private->Queue.Q[Private->Queue.Front];
- Private->Queue.Front = (Private->Queue.Front + 1) % MAX_Q;
- Private->Queue.Count--;
-
- Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UgaPrivateCheckQ (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- EFI_NOT_READY - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- if (Private->Queue.Count == 0) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Simple Text In implementation.
-//
-
-EFI_STATUS
-EFIAPI
-WinNtUgaSimpleTextInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_INPUT_KEY Key;
- EFI_TPL OldTpl;
-
- Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- //
- // A reset is draining the Queue
- //
- while (UgaPrivateDeleteQ (Private, &Key) == EFI_SUCCESS)
- ;
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-WinNtUgaSimpleTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Key - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = UGA_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = UgaPrivateCheckQ (Private);
- if (!EFI_ERROR (Status)) {
- //
- // If a Key press exists try and read it.
- //
- Status = UgaPrivateDeleteQ (Private, Key);
- }
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-STATIC
-VOID
-EFIAPI
-WinNtUgaSimpleTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UGA_PRIVATE_DATA *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Private = (UGA_PRIVATE_DATA *) Context;
-
- //
- // Enter critical section
- //
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = UgaPrivateCheckQ (Private);
- if (!EFI_ERROR (Status)) {
- //
- // If a there is a key in the queue signal our event.
- //
- gBS->SignalEvent (Event);
- } else {
- //
- // We need to sleep or NT will schedule this thread with such high
- // priority that WinProc thread will never run and we will not see
- // keyboard input. This Sleep makes the syste run 10x faster, so don't
- // remove it.
- //
- Private->WinNtThunk->Sleep (1);
- }
-
- //
- // Leave critical section and return
- //
- gBS->RestoreTPL (OldTpl);
-}
-
-EFI_STATUS
-WinNtUgaInitializeSimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
-
- UgaPrivateCreateQ (Private);
-
- //
- // Initialize Simple Text In protoocol
- //
- Private->SimpleTextIn.Reset = WinNtUgaSimpleTextInReset;
- Private->SimpleTextIn.ReadKeyStroke = WinNtUgaSimpleTextInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- WinNtUgaSimpleTextInWaitForKey,
- Private,
- &Private->SimpleTextIn.WaitForKey
- );
-
- return Status;
-}
-
-EFI_STATUS
-WinNtUgaDestroySimpleTextInForWindow (
- IN UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UgaPrivateDestroyQ (Private);
- return EFI_SUCCESS;
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
deleted file mode 100644
index ebaf0b3a80..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Uga/WinNtUgaScreen.c
+++ /dev/null
@@ -1,990 +0,0 @@
-/*++
-
-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 just does graphics.
-
---*/
-
-#include "WinNtUga.h"
-
-EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
-DWORD mTlsIndex = TLS_OUT_OF_INDEXES;
-DWORD mTlsIndexUseCount = 0; // lets us know when we can free mTlsIndex.
-static EFI_EVENT mUgaScreenExitBootServicesEvent;
-
-EFI_STATUS
-WinNtUgaStartWindow (
- IN UGA_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- );
-
-STATIC
-VOID
-EFIAPI
-KillNtUgaThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// UGA Protocol Member Functions
-//
-
-EFI_STATUS
-EFIAPI
-WinNtUgaGetMode (
- EFI_UGA_DRAW_PROTOCOL *This,
- UINT32 *HorizontalResolution,
- UINT32 *VerticalResolution,
- UINT32 *ColorDepth,
- UINT32 *RefreshRate
- )
-/*++
-
- Routine Description:
- Return the current video mode information.
-
- Arguments:
- This - Protocol instance pointer.
- HorizontalResolution - Current video horizontal resolution in pixels
- VerticalResolution - Current video Vertical resolution in pixels
- ColorDepth - Current video color depth in bits per pixel
- RefreshRate - Current video refresh rate in Hz.
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
- EFI_INVALID_PARAMETER - One of the input args was NULL.
-
---*/
-// TODO: ADD IN/OUT description here
-{
- UGA_PRIVATE_DATA *Private;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- return EFI_NOT_STARTED;
- }
-
- if ((HorizontalResolution == NULL) ||
- (VerticalResolution == NULL) ||
- (ColorDepth == NULL) ||
- (RefreshRate == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *HorizontalResolution = Private->HorizontalResolution;
- *VerticalResolution = Private->VerticalResolution;
- *ColorDepth = Private->ColorDepth;
- *RefreshRate = Private->RefreshRate;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtUgaSetMode (
- EFI_UGA_DRAW_PROTOCOL *This,
- UINT32 HorizontalResolution,
- UINT32 VerticalResolution,
- UINT32 ColorDepth,
- UINT32 RefreshRate
- )
-/*++
-
- Routine Description:
- Return the current video mode information.
-
- Arguments:
- This - Protocol instance pointer.
- HorizontalResolution - Current video horizontal resolution in pixels
- VerticalResolution - Current video Vertical resolution in pixels
- ColorDepth - Current video color depth in bits per pixel
- RefreshRate - Current video refresh rate in Hz.
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
- EFI_INVALID_PARAMETER - One of the input args was NULL.
-
---*/
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: ADD IN/OUT description here
-{
- EFI_STATUS Status;
- UGA_PRIVATE_DATA *Private;
- EFI_UGA_PIXEL Fill;
- EFI_UGA_PIXEL *NewFillLine;
- RECT Rect;
- UINTN Size;
- UINTN Width;
- UINTN Height;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- Status = WinNtUgaStartWindow (
- Private,
- HorizontalResolution,
- VerticalResolution,
- ColorDepth,
- RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Private->HardwareNeedsStarting = FALSE;
- } else {
- //
- // Change the resolution and resize of the window
- //
-
- //
- // Free the old buffer. We do not save the content of the old buffer since the
- // screen is to be cleared anyway. Clearing the screen is required by the EFI spec.
- // See EFI spec chepter 10.5-EFI_UGA_DRAW_PROTOCOL.SetMode()
- //
- Private->WinNtThunk->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
- //
- // Allocate DIB frame buffer directly from NT for performance enhancement
- // This buffer is the virtual screen/frame buffer. This buffer is not the
- // same a a frame buffer. The first row of this buffer will be the bottom
- // line of the image. This is an artifact of the way we draw to the screen.
- //
- Size = HorizontalResolution * VerticalResolution * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
- Private->WinNtThunk->GetProcessHeap (),
- HEAP_ZERO_MEMORY,
- Size
- );
-
- //
- // Update the virtual screen info data structure
- //
- Private->VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo->bV4Width = HorizontalResolution;
- Private->VirtualScreenInfo->bV4Height = VerticalResolution;
- Private->VirtualScreenInfo->bV4Planes = 1;
- Private->VirtualScreenInfo->bV4BitCount = 32;
- //
- // uncompressed
- //
- Private->VirtualScreenInfo->bV4V4Compression = BI_RGB;
-
- //
- // The rest of the allocated memory block is the virtual screen buffer
- //
- Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
-
- //
- // Use the AdjuctWindowRect fuction to calculate the real width and height
- // of the new window including the border and caption
- //
- Rect.left = 0;
- Rect.top = 0;
- Rect.right = HorizontalResolution;
- Rect.bottom = VerticalResolution;
-
- Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
- Width = Rect.right - Rect.left;
- Height = Rect.bottom - Rect.top;
-
- //
- // Retrieve the original window position information
- //
- Private->WinNtThunk->GetWindowRect (Private->WindowHandle, &Rect);
-
- //
- // Adjust the window size
- //
- Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);
-
- }
-
- NewFillLine = AllocatePool (sizeof (EFI_UGA_PIXEL) * HorizontalResolution);
- if (NewFillLine == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- if (Private->FillLine != NULL) {
- FreePool (Private->FillLine);
- }
-
- Private->FillLine = NewFillLine;
-
- Private->HorizontalResolution = HorizontalResolution;
- Private->VerticalResolution = VerticalResolution;
- Private->ColorDepth = ColorDepth;
- Private->RefreshRate = RefreshRate;
-
- Fill.Red = 0x00;
- Fill.Green = 0x00;
- Fill.Blue = 0x00;
- This->Blt (
- This,
- &Fill,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- HorizontalResolution,
- VerticalResolution,
- HorizontalResolution * sizeof (EFI_UGA_PIXEL)
- );
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtUgaBlt (
- IN EFI_UGA_DRAW_PROTOCOL *This,
- IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-/*++
-
- 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
- bigger than the current video screen the image will be clipped.
-
- Arguments:
- This - Protocol instance pointer.
- 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
- 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
- used.
- 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
- buffer.
-
---*/
-// TODO: SourceY - add argument and description to function comment
-// TODO: DestinationX - add argument and description to function comment
-// TODO: DestinationY - add argument and description to function comment
-// TODO: Delta - add argument and description to function comment
-{
- UGA_PRIVATE_DATA *Private;
- EFI_TPL OriginalTPL;
- UINTN DstY;
- UINTN SrcY;
- RGBQUAD *VScreen;
- RGBQUAD *VScreenSrc;
- EFI_UGA_PIXEL *Blt;
- UINTN Index;
- RECT Rect;
- EFI_UGA_PIXEL *FillPixel;
-
- Private = UGA_DRAW_PRIVATE_DATA_FROM_THIS (This);
-
- if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // If Delta is zero, then the entire BltBuffer is being used, so Delta
- // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
- // the number of bytes in each row can be computed.
- //
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_UGA_PIXEL);
- }
-
- //
- // We need to fill the Virtual Screen buffer with the blt data.
- // The virtual screen is upside down, as the first row is the bootom row of
- // the image.
- //
-
- if (BltOperation == EfiUgaVideoToBltBuffer) {
-
- //
- // Video to BltBuffer: Source is Video, destination is BltBuffer
- //
- if (SourceY + Height > Private->VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (SourceX + Width > Private->HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + DestinationX * sizeof (EFI_UGA_PIXEL));
- VScreen = &Private->VirtualScreen[(Private->VerticalResolution - SrcY - 1) * Private->HorizontalResolution + SourceX];
- CopyMem (Blt, VScreen, sizeof (EFI_UGA_PIXEL) * Width);
- }
- } else {
- //
- // BltBuffer to Video: Source is BltBuffer, destination is Video
- //
- if (DestinationY + Height > Private->VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DestinationX + Width > Private->HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- if (BltOperation == EfiUgaVideoFill) {
- FillPixel = BltBuffer;
- for (Index = 0; Index < Width; Index++) {
- Private->FillLine[Index] = *FillPixel;
- }
- }
-
- for (Index = 0; Index < Height; Index++) {
- if (DestinationY <= SourceY) {
- SrcY = SourceY + Index;
- DstY = DestinationY + Index;
- } else {
- SrcY = SourceY + Height - Index - 1;
- DstY = DestinationY + Height - Index - 1;
- }
-
- VScreen = &Private->VirtualScreen[(Private->VerticalResolution - DstY - 1) * Private->HorizontalResolution + DestinationX];
- switch (BltOperation) {
- case EfiUgaBltBufferToVideo:
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_UGA_PIXEL));
- CopyMem (VScreen, Blt, Width * sizeof (EFI_UGA_PIXEL));
- break;
-
- case EfiUgaVideoToVideo:
- VScreenSrc = &Private->VirtualScreen[(Private->VerticalResolution - SrcY - 1) * Private->HorizontalResolution + SourceX];
- CopyMem (VScreen, VScreenSrc, Width * sizeof (EFI_UGA_PIXEL));
- break;
-
- case EfiUgaVideoFill:
- CopyMem (VScreen, Private->FillLine, Width * sizeof (EFI_UGA_PIXEL));
- break;
- }
- }
- }
-
- if (BltOperation != EfiUgaVideoToBltBuffer) {
- //
- // Mark the area we just blted as Invalid so WM_PAINT will update.
- //
- Rect.left = DestinationX;
- Rect.top = DestinationY;
- Rect.right = DestinationX + Width;
- Rect.bottom = DestinationY + Height;
- Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);
-
- //
- // Send the WM_PAINT message to the thread that is drawing the window. We
- // are in the main thread and the window drawing is in a child thread.
- // There is a child thread per window. We have no CriticalSection or Mutex
- // since we write the data and the other thread displays the data. While
- // 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);
- }
-
- gBS->RestoreTPL (OriginalTPL);
-
- return EFI_SUCCESS;
-}
-
-
-//
-// Construction and Destruction functions
-//
-
-EFI_STATUS
-WinNtUgaSupported (
- IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: WinNtIo - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- //
- // Check to see if the IO abstraction represents a device type we support.
- //
- // This would be replaced a check of PCI subsystem ID, etc.
- //
- if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtUgaGuid)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-LRESULT
-CALLBACK
-WinNtUgaThreadWindowProc (
- IN HWND hwnd,
- IN UINT iMsg,
- IN WPARAM wParam,
- IN LPARAM lParam
- )
-/*++
-
-Routine Description:
- Win32 Windows event handler.
-
-Arguments:
- See Win32 Book
-
-Returns:
- See Win32 Book
-
---*/
-// TODO: hwnd - add argument and description to function comment
-// TODO: iMsg - add argument and description to function comment
-// TODO: wParam - add argument and description to function comment
-// TODO: lParam - add argument and description to function comment
-{
- UGA_PRIVATE_DATA *Private;
- UINTN Size;
- HDC Handle;
- PAINTSTRUCT PaintStruct;
- LPARAM Index;
- EFI_INPUT_KEY Key;
-
- //
- // BugBug - if there are two instances of this DLL in memory (such as is
- // the case for ERM), the correct instance of this function may not be called.
- // This also means that the address of the mTlsIndex value will be wrong, and
- // the value may be wrong too.
- //
-
-
- //
- // Use mTlsIndex global to get a Thread Local Storage version of Private.
- // This works since each Uga protocol has a unique Private data instance and
- // a unique thread.
- //
- Private = mWinNt->TlsGetValue (mTlsIndex);
- ASSERT (NULL != Private);
-
- switch (iMsg) {
- case WM_CREATE:
- Size = Private->HorizontalResolution * Private->VerticalResolution * sizeof (RGBQUAD);
-
- //
- // Allocate DIB frame buffer directly from NT for performance enhancement
- // This buffer is the virtual screen/frame buffer. This buffer is not the
- // same a a frame buffer. The first fow of this buffer will be the bottom
- // line of the image. This is an artifact of the way we draw to the screen.
- //
- Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
- Private->WinNtThunk->GetProcessHeap (),
- HEAP_ZERO_MEMORY,
- Size
- );
-
- Private->VirtualScreenInfo->bV4Size = sizeof (BITMAPV4HEADER);
- Private->VirtualScreenInfo->bV4Width = Private->HorizontalResolution;
- Private->VirtualScreenInfo->bV4Height = Private->VerticalResolution;
- Private->VirtualScreenInfo->bV4Planes = 1;
- Private->VirtualScreenInfo->bV4BitCount = 32;
- //
- // uncompressed
- //
- Private->VirtualScreenInfo->bV4V4Compression = BI_RGB;
- Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
- return 0;
-
- case WM_PAINT:
- //
- // I have not found a way to convert hwnd into a Private context. So for
- // now we use this API to convert hwnd to Private data.
- //
-
- Handle = mWinNt->BeginPaint (hwnd, &PaintStruct);
-
- mWinNt->SetDIBitsToDevice (
- Handle, // Destination Device Context
- 0, // Destination X - 0
- 0, // Destination Y - 0
- Private->HorizontalResolution, // Width
- Private->VerticalResolution, // Height
- 0, // Source X
- 0, // Source Y
- 0, // DIB Start Scan Line
- Private->VerticalResolution, // Number of scan lines
- Private->VirtualScreen, // Address of array of DIB bits
- (BITMAPINFO *) Private->VirtualScreenInfo, // Address of structure with bitmap info
- DIB_RGB_COLORS // RGB or palette indexes
- );
-
- mWinNt->EndPaint (hwnd, &PaintStruct);
- return 0;
-
- //
- // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
- //
- case WM_SYSKEYDOWN:
- Key.ScanCode = 0;
- switch (wParam) {
- case VK_F10:
- Key.ScanCode = SCAN_F10;
- Key.UnicodeChar = 0;
- UgaPrivateAddQ (Private, Key);
- return 0;
- }
- break;
-
- case WM_KEYDOWN:
- Key.ScanCode = 0;
- switch (wParam) {
- case VK_HOME: Key.ScanCode = SCAN_HOME; break;
- case VK_END: Key.ScanCode = SCAN_END; break;
- case VK_LEFT: Key.ScanCode = SCAN_LEFT; break;
- case VK_RIGHT: Key.ScanCode = SCAN_RIGHT; break;
- case VK_UP: Key.ScanCode = SCAN_UP; break;
- case VK_DOWN: Key.ScanCode = SCAN_DOWN; break;
- case VK_DELETE: Key.ScanCode = SCAN_DELETE; break;
- case VK_INSERT: Key.ScanCode = SCAN_INSERT; break;
- case VK_PRIOR: Key.ScanCode = SCAN_PAGE_UP; break;
- case VK_NEXT: Key.ScanCode = SCAN_PAGE_DOWN; break;
- case VK_ESCAPE: Key.ScanCode = SCAN_ESC; break;
-
- case VK_F1: Key.ScanCode = SCAN_F1; break;
- case VK_F2: Key.ScanCode = SCAN_F2; break;
- case VK_F3: Key.ScanCode = SCAN_F3; break;
- case VK_F4: Key.ScanCode = SCAN_F4; break;
- case VK_F5: Key.ScanCode = SCAN_F5; break;
- case VK_F6: Key.ScanCode = SCAN_F6; break;
- case VK_F7: Key.ScanCode = SCAN_F7; break;
- 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;
- }
-
- if (Key.ScanCode != 0) {
- Key.UnicodeChar = 0;
- UgaPrivateAddQ (Private, Key);
- }
-
- return 0;
-
- case WM_CHAR:
- //
- // The ESC key also generate WM_CHAR.
- //
- if (wParam == 0x1B) {
- return 0;
- }
-
- for (Index = 0; Index < (lParam & 0xffff); Index++) {
- if (wParam != 0) {
- Key.UnicodeChar = (CHAR16) wParam;
- Key.ScanCode = 0;
- UgaPrivateAddQ (Private, Key);
- }
- }
-
- return 0;
-
- case WM_CLOSE:
- //
- // This close message is issued by user, core is not aware of this,
- // so don't release the window display resource, just hide the window.
- //
- Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_HIDE);
- return 0;
-
- case WM_DESTROY:
- mWinNt->DestroyWindow (hwnd);
- mWinNt->PostQuitMessage (0);
-
- mWinNt->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
-
- mWinNt->ExitThread (0);
- return 0;
-
- default:
- break;
- };
-
- return mWinNt->DefWindowProc (hwnd, iMsg, wParam, lParam);
-}
-
-DWORD
-WINAPI
-WinNtUgaThreadWinMain (
- LPVOID lpParameter
- )
-/*++
-
-Routine Description:
-
- This thread simulates the end of WinMain () aplication. Each Winow nededs
- to process it's events. The messages are dispatched to
- WinNtUgaThreadWindowProc ().
-
- Be very careful sine WinNtUgaThreadWinMain () and WinNtUgaThreadWindowProc ()
- are running in a seperate thread. We have to do this to process the events.
-
-Arguments:
-
- lpParameter - Handle of window to manage.
-
-Returns:
-
- if a WM_QUIT message is returned exit.
-
---*/
-{
- MSG Message;
- UGA_PRIVATE_DATA *Private;
- ATOM Atom;
- RECT Rect;
-
- Private = (UGA_PRIVATE_DATA *) lpParameter;
- ASSERT (NULL != Private);
-
- //
- // Since each thread has unique private data, save the private data in Thread
- // Local Storage slot. Then the shared global mTlsIndex can be used to get
- // thread specific context.
- //
- Private->WinNtThunk->TlsSetValue (mTlsIndex, Private);
-
- Private->ThreadId = Private->WinNtThunk->GetCurrentThreadId ();
-
- Private->WindowsClass.cbSize = sizeof (WNDCLASSEX);
- Private->WindowsClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
- Private->WindowsClass.lpfnWndProc = WinNtUgaThreadWindowProc;
- Private->WindowsClass.cbClsExtra = 0;
- Private->WindowsClass.cbWndExtra = 0;
- Private->WindowsClass.hInstance = NULL;
- Private->WindowsClass.hIcon = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
- Private->WindowsClass.hCursor = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);
- Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;
- Private->WindowsClass.lpszMenuName = NULL;
- Private->WindowsClass.lpszClassName = WIN_NT_UGA_CLASS_NAME;
- Private->WindowsClass.hIconSm = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
-
- //
- // This call will fail after the first time, but thats O.K. since we only need
- // WIN_NT_UGA_CLASS_NAME to exist to create the window.
- //
- // Note: Multiple instances of this DLL will use the same instance of this
- // Class, including the callback function, unless the Class is unregistered and
- // successfully registered again.
- //
- Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);
-
- //
- // Setting Rect values to allow for the AdjustWindowRect to provide
- // us the correct sizes for the client area when doing the CreateWindowEx
- //
- Rect.top = 0;
- Rect.bottom = Private->VerticalResolution;
- Rect.left = 0;
- Rect.right = Private->HorizontalResolution;
-
- Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
-
- Private->WindowHandle = Private->WinNtThunk->CreateWindowEx (
- 0,
- WIN_NT_UGA_CLASS_NAME,
- Private->WindowName,
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- Rect.right - Rect.left,
- Rect.bottom - Rect.top,
- NULL,
- NULL,
- NULL,
- &Private
- );
-
- //
- // The reset of this thread is the standard winows program. We need a sperate
- // thread since we must process the message loop to make windows act like
- // windows.
- //
-
- Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_SHOW);
- Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
-
- //
- // Let the main thread get some work done
- //
- Private->WinNtThunk->ReleaseSemaphore (Private->ThreadInited, 1, NULL);
-
- //
- // This is the message loop that all Windows programs need.
- //
- while (Private->WinNtThunk->GetMessage (&Message, Private->WindowHandle, 0, 0)) {
- Private->WinNtThunk->TranslateMessage (&Message);
- Private->WinNtThunk->DispatchMessage (&Message);
- }
-
- return Message.wParam;
-}
-
-EFI_STATUS
-WinNtUgaStartWindow (
- IN UGA_PRIVATE_DATA *Private,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Private - TODO: add argument description
- HorizontalResolution - TODO: add argument description
- VerticalResolution - TODO: add argument description
- ColorDepth - TODO: add argument description
- RefreshRate - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- DWORD NewThreadId;
-
-
- mWinNt = Private->WinNtThunk;
-
- //
- // Initialize a Thread Local Storge variable slot. We use TLS to get the
- // correct Private data instance into the windows thread.
- //
- if (mTlsIndex == TLS_OUT_OF_INDEXES) {
- ASSERT (0 == mTlsIndexUseCount);
- mTlsIndex = Private->WinNtThunk->TlsAlloc ();
- }
-
- //
- // always increase the use count!
- //
- mTlsIndexUseCount++;
-
- Private->HorizontalResolution = HorizontalResolution;
- Private->VerticalResolution = VerticalResolution;
-
- //
- // Register to be notified on exit boot services so we can destroy the window.
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_CALLBACK,
- KillNtUgaThread,
- Private,
- &mUgaScreenExitBootServicesEvent
- );
-
- Private->ThreadInited = Private->WinNtThunk->CreateSemaphore (NULL, 0, 1, NULL);
- Private->ThreadHandle = Private->WinNtThunk->CreateThread (
- NULL,
- 0,
- WinNtUgaThreadWinMain,
- (VOID *) Private,
- 0,
- &NewThreadId
- );
-
- //
- // The other thread has entered the windows message loop so we can
- // continue our initialization.
- //
- Private->WinNtThunk->WaitForSingleObject (Private->ThreadInited, INFINITE);
- Private->WinNtThunk->CloseHandle (Private->ThreadInited);
-
- return Status;
-}
-
-EFI_STATUS
-WinNtUgaConstructor (
- UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- Private->UgaDraw.GetMode = WinNtUgaGetMode;
- Private->UgaDraw.SetMode = WinNtUgaSetMode;
- Private->UgaDraw.Blt = WinNtUgaBlt;
-
- Private->HardwareNeedsStarting = TRUE;
- Private->FillLine = NULL;
-
- WinNtUgaInitializeSimpleTextInForWindow (Private);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WinNtUgaDestructor (
- UGA_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Private - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT32 UnregisterReturn;
-
- if (!Private->HardwareNeedsStarting) {
- //
- // BugBug: Shutdown Uga Hardware and any child devices.
- //
- Private->WinNtThunk->SendMessage (Private->WindowHandle, WM_DESTROY, 0, 0);
- Private->WinNtThunk->CloseHandle (Private->ThreadHandle);
-
- mTlsIndexUseCount--;
-
- //
- // The callback function for another window could still be called,
- // so we need to make sure there are no more users of mTlsIndex.
- //
- if (0 == mTlsIndexUseCount) {
- ASSERT (TLS_OUT_OF_INDEXES != mTlsIndex);
-
- Private->WinNtThunk->TlsFree (mTlsIndex);
- mTlsIndex = TLS_OUT_OF_INDEXES;
-
- UnregisterReturn = Private->WinNtThunk->UnregisterClass (
- Private->WindowsClass.lpszClassName,
- Private->WindowsClass.hInstance
- );
- }
-
- WinNtUgaDestroySimpleTextInForWindow (Private);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-EFIAPI
-KillNtUgaThread (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- This is the UGA screen's callback notification function for exit-boot-services.
- All we do here is call WinNtUgaDestructor().
-
-Arguments:
-
- Event - not used
- Context - pointer to the Private structure.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- Status = WinNtUgaDestructor (Context);
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c
deleted file mode 100644
index b03fc8b264..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/ComponentName.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "WinNtBusDriver.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-WinNtBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gWinNtBusDriverComponentName = {
- WinNtBusDriverComponentNameGetDriverName,
- WinNtBusDriverComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mWinNtBusDriverNameTable[] = {
- { "eng", L"Windows Bus Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gWinNtBusDriverComponentName.SupportedLanguages,
- mWinNtBusDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_IO_DEVICE *Private;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gWinNtBusDriverBinding.DriverBindingHandle,
- &gEfiWinNtThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // This is a bus driver, so ChildHandle can not be NULL.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiWinNtThunkProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- gWinNtBusDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = WIN_NT_IO_DEVICE_FROM_THIS (WinNtIo);
-
- return LookupUnicodeString (
- Language,
- gWinNtBusDriverComponentName.SupportedLanguages,
- Private->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
deleted file mode 100644
index b0e1c2b816..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
+++ /dev/null
@@ -1,707 +0,0 @@
-/*+++
-
-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:
-
- WinNtBusDriver.c
-
-Abstract:
-
-This following section documents the envirnoment variables for the Win NT
-build. These variables are used to define the (virtual) hardware
-configuration of the NT environment
-
-A ! can be used to seperate multiple instances in a variable. Each
-instance represents a seperate hardware device.
-
-EFI_WIN_NT_PHYSICAL_DISKS - maps to drives on your system
-EFI_WIN_NT_VIRTUAL_DISKS - maps to a device emulated by a file
-EFI_WIN_NT_FILE_SYSTEM - mouts a directory as a file system
-EFI_WIN_NT_CONSOLE - make a logical comand line window (only one!)
-EFI_WIN_NT_UGA - Builds UGA Windows of Width and Height
-EFI_WIN_NT_SERIAL_PORT - maps physical serial ports
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- NT envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_WIN_NT_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_WIN_NT_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use NT to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048
-
- EFI_WIN_NT_FILE_SYSTEM =
- <directory path>[!...]
-
- Mounting the two directories C:\FOO and C:\BAR would look like:
- EFI_WIN_NT_FILE_SYSTEM=c:\foo!c:\bar
-
- EFI_WIN_NT_CONSOLE =
- <window title>
-
- Declaring a text console window with the title "My EFI Console" woild look like:
- EFI_WIN_NT_CONSOLE=My EFI Console
-
- EFI_WIN_NT_UGA =
- <width> <height>[!...]
-
- Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
- Example : EFI_WIN_NT_UGA=800 600!1024 768
-
- EFI_WIN_NT_SERIAL_PORT =
- <port name>[!...]
-
- Declaring two serial ports on COM1 and COM2 would look like:
- Example : EFI_WIN_NT_SERIAL_PORT=COM1!COM2
-
- EFI_WIN_NT_PASS_THROUGH =
- <BaseAddress>;<Bus#>;<Device#>;<Function#>
-
- Declaring a base address of 0xE0000000 (used for PCI Express devices)
- and having NT32 talk to a device located at bus 0, device 1, function 0:
- Example : EFI_WIN_NT_PASS_THROUGH=E000000;0;1;0
-
----*/
-
-#include "WinNtBusDriver.h"
-
-extern EFI_GUID gWinNtBusDriverGuid;
-//
-// DriverBinding protocol global
-//
-EFI_DRIVER_BINDING_PROTOCOL gWinNtBusDriverBinding = {
- WinNtBusDriverBindingSupported,
- WinNtBusDriverBindingStart,
- WinNtBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-#define NT_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(NT_PCD_ENTRY))
-
-//
-// Table to map NT Environment variable to the GUID that should be in
-// device path.
-//
-static NT_PCD_ENTRY mPcdEnvironment[] = {
- PcdToken(PcdWinNtConsole), &gEfiWinNtConsoleGuid,
- PcdToken(PcdWinNtUga), &gEfiWinNtUgaGuid,
- PcdToken(PcdWinNtGop), &gEfiWinNtGopGuid,
- PcdToken(PcdWinNtSerialPort), &gEfiWinNtSerialPortGuid,
- PcdToken(PcdWinNtFileSystem), &gEfiWinNtFileSystemGuid,
- PcdToken(PcdWinNtVirtualDisk), &gEfiWinNtVirtualDisksGuid,
- PcdToken(PcdWinNtPhysicalDisk), &gEfiWinNtPhysicalDisksGuid,
- PcdToken(PcdWinNtCpuModel), &gEfiWinNtCPUModelGuid,
- PcdToken(PcdWinNtCpuSpeed), &gEfiWinNtCPUSpeedGuid,
- PcdToken(PcdWinNtMemorySize), &gEfiWinNtMemoryGuid
-};
-
-VOID *
-AllocateMemory (
- IN UINTN Size
- )
-{
- VOID *Buffer;
-
- Buffer = AllocatePool (Size);
- ASSERT (Buffer != NULL);
-
- return Buffer;
-}
-
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: ControllerHandle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
- UINTN Index;
-
- //
- // Check the contents of the first Device Path Node of RemainingDevicePath to make sure
- // it is a legal Device Path Node for this bus driver's children.
- //
- if (RemainingDevicePath != NULL) {
- if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||
- RemainingDevicePath->SubType != HW_VENDOR_DP ||
- DevicePathNodeLength(RemainingDevicePath) != sizeof(WIN_NT_VENDOR_DEVICE_PATH_NODE)) {
- return EFI_UNSUPPORTED;
- }
-
- for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {
- if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {
- break;
- }
- }
-
- if (Index >= NT_PCD_ARRAY_SIZE) {
- return EFI_UNSUPPORTED;
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- &ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- &WinNtThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Since we call through WinNtThunk we need to make sure it's valid
- //
- Status = EFI_SUCCESS;
- if (WinNtThunk->Signature != EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) {
- Status = EFI_UNSUPPORTED;
- }
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: ControllerHandle - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_STATUS InstallStatus;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- WIN_NT_BUS_DEVICE *WinNtBusDevice;
- WIN_NT_IO_DEVICE *WinNtDevice;
- UINTN Index;
- CHAR16 *StartString;
- CHAR16 *SubString;
- UINT16 Count;
- UINTN StringSize;
- UINT16 ComponentName[MAX_NT_ENVIRNMENT_VARIABLE_LENGTH];
- WIN_NT_VENDOR_DEVICE_PATH_NODE *Node;
- BOOLEAN CreateDevice;
- CHAR16 *TempStr;
- CHAR16 *PcdTempStr;
- UINTN TempStrSize;
-
- Status = EFI_UNSUPPORTED;
-
- //
- // Grab the protocols we need
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- &ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- &WinNtThunk,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- WinNtBusDevice = AllocatePool (sizeof (WIN_NT_BUS_DEVICE));
- if (WinNtBusDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- WinNtBusDevice->Signature = WIN_NT_BUS_DEVICE_SIGNATURE;
- WinNtBusDevice->ControllerNameTable = NULL;
-
- AddUnicodeString (
- "eng",
- gWinNtBusDriverComponentName.SupportedLanguages,
- &WinNtBusDevice->ControllerNameTable,
- L"Windows Bus Controller"
- );
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gWinNtBusDriverGuid,
- WinNtBusDevice,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);
- FreePool (WinNtBusDevice);
- return Status;
- }
- }
-
- //
- // Loop on the Variable list. Parse each variable to produce a set of handles that
- // represent virtual hardware devices.
- //
- InstallStatus = EFI_NOT_FOUND;
- for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) {
- PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token);
- ASSERT (PcdTempStr != NULL);
-
- TempStrSize = StrLen (PcdTempStr);
- TempStr = AllocateMemory ((TempStrSize * sizeof (CHAR16)) + 1);
- StrCpy (TempStr, PcdTempStr);
-
- StartString = TempStr;
-
- //
- // Parse the envirnment variable into sub strings using '!' as a delimator.
- // Each substring needs it's own handle to be added to the system. This code
- // does not understand the sub string. Thats the device drivers job.
- //
- Count = 0;
- while (*StartString != '\0') {
-
- //
- // Find the end of the sub string
- //
- SubString = StartString;
- while (*SubString != '\0' && *SubString != '!') {
- SubString++;
- }
-
- if (*SubString == '!') {
- //
- // Replace token with '\0' to make sub strings. If this is the end
- // of the string SubString will already point to NULL.
- //
- *SubString = '\0';
- SubString++;
- }
-
- CreateDevice = TRUE;
- if (RemainingDevicePath != NULL) {
- CreateDevice = FALSE;
- Node = (WIN_NT_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;
- if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&
- Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&
- DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)
- ) {
- if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&
- Node->Instance == Count
- ) {
- CreateDevice = TRUE;
- }
- }
- }
-
- if (CreateDevice) {
-
- //
- // Allocate instance structure, and fill in parent information.
- //
- WinNtDevice = AllocateMemory (sizeof (WIN_NT_IO_DEVICE));
- if (WinNtDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- WinNtDevice->Handle = NULL;
- WinNtDevice->ControllerHandle = ControllerHandle;
- WinNtDevice->ParentDevicePath = ParentDevicePath;
-
- WinNtDevice->WinNtIo.WinNtThunk = WinNtThunk;
-
- //
- // Plus 2 to account for the NULL at the end of the Unicode string
- //
- StringSize = (UINTN) ((UINT8 *) SubString - (UINT8 *) StartString) + sizeof (CHAR16);
- WinNtDevice->WinNtIo.EnvString = AllocateMemory (StringSize);
- if (WinNtDevice->WinNtIo.EnvString != NULL) {
- CopyMem (WinNtDevice->WinNtIo.EnvString, StartString, StringSize);
- }
-
- WinNtDevice->ControllerNameTable = NULL;
-
- WinNtThunk->SPrintf (ComponentName, sizeof (ComponentName), L"%s", WinNtDevice->WinNtIo.EnvString);
-
- WinNtDevice->DevicePath = WinNtBusCreateDevicePath (
- ParentDevicePath,
- mPcdEnvironment[Index].DevicePathGuid,
- Count
- );
- if (WinNtDevice->DevicePath == NULL) {
- FreePool (WinNtDevice);
- return EFI_OUT_OF_RESOURCES;
- }
-
- AddUnicodeString (
- "eng",
- gWinNtBusDriverComponentName.SupportedLanguages,
- &WinNtDevice->ControllerNameTable,
- ComponentName
- );
-
- WinNtDevice->WinNtIo.TypeGuid = mPcdEnvironment[Index].DevicePathGuid;
- WinNtDevice->WinNtIo.InstanceNumber = Count;
-
- WinNtDevice->Signature = WIN_NT_IO_DEVICE_SIGNATURE;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &WinNtDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- WinNtDevice->DevicePath,
- &gEfiWinNtIoProtocolGuid,
- &WinNtDevice->WinNtIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);
- FreePool (WinNtDevice);
- } else {
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- &WinNtThunk,
- This->DriverBindingHandle,
- WinNtDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (!EFI_ERROR (Status)) {
- InstallStatus = EFI_SUCCESS;
- }
- }
- }
-
- //
- // Parse Next sub string. This will point to '\0' if we are at the end.
- //
- Count++;
- StartString = SubString;
- }
-
- FreePool (TempStr);
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: ControllerHandle - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
- WIN_NT_BUS_DEVICE *WinNtBusDevice;
- WIN_NT_IO_DEVICE *WinNtDevice;
- EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gWinNtBusDriverGuid,
- &WinNtBusDevice,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->UninstallMultipleProtocolInterfaces (
- ControllerHandle,
- &gWinNtBusDriverGuid,
- WinNtBusDevice,
- NULL
- );
-
- FreeUnicodeStringTable (WinNtBusDevice->ControllerNameTable);
-
- FreePool (WinNtBusDevice);
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiWinNtIoProtocolGuid,
- &WinNtIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
-
- WinNtDevice = WIN_NT_IO_DEVICE_FROM_THIS (WinNtIo);
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- This->DriverBindingHandle,
- WinNtDevice->Handle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- WinNtDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- WinNtDevice->DevicePath,
- &gEfiWinNtIoProtocolGuid,
- &WinNtDevice->WinNtIo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEfiWinNtThunkProtocolGuid,
- (VOID **) &WinNtThunk,
- This->DriverBindingHandle,
- WinNtDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- //
- // Close the child handle
- //
- FreeUnicodeStringTable (WinNtDevice->ControllerNameTable);
- FreePool (WinNtDevice);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-WinNtBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- )
-/*++
-
-Routine Description:
- Create a device path node using Guid and InstanceNumber and append it to
- the passed in RootDevicePath
-
-Arguments:
- RootDevicePath - Root of the device path to return.
-
- Guid - GUID to use in vendor device path node.
-
- InstanceNumber - Instance number to use in the vendor device path. This
- argument is needed to make sure each device path is unique.
-
-Returns:
-
- EFI_DEVICE_PATH_PROTOCOL
-
---*/
-{
- WIN_NT_VENDOR_DEVICE_PATH_NODE DevicePath;
-
- DevicePath.VendorDevicePath.Header.Type = HARDWARE_DEVICE_PATH;
- DevicePath.VendorDevicePath.Header.SubType = HW_VENDOR_DP;
- SetDevicePathNodeLength (&DevicePath.VendorDevicePath.Header, sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE));
-
- //
- // The GUID defines the Class
- //
- CopyMem (&DevicePath.VendorDevicePath.Guid, Guid, sizeof (EFI_GUID));
-
- //
- // Add an instance number so we can make sure there are no Device Path
- // duplication.
- //
- DevicePath.Instance = InstanceNumber;
-
- return AppendDevicePathNode (
- RootDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &DevicePath
- );
-}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h
deleted file mode 100644
index 414465b8b2..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++
-
-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.
-
-Module Name:
-
- WinNtBusDriver.h
-
-Abstract:
-
-This following section documents the envirnoment variables for the Win NT
-build. These variables are used to define the (virtual) hardware
-configuration of the NT environment
-
-A ! can be used to seperate multiple instances in a variable. Each
-instance represents a seperate hardware device.
-
-EFI_WIN_NT_PHYSICAL_DISKS - maps to drives on your system
-EFI_WIN_NT_VIRTUAL_DISKS - maps to a device emulated by a file
-EFI_WIN_NT_FILE_SYSTEM - mouts a directory as a file system
-EFI_WIN_NT_CONSOLE - make a logical comand line window (only one!)
-EFI_WIN_NT_UGA - Builds UGA Windows of Width and Height
-EFI_WIN_NT_SERIAL_PORT - maps physical serial ports
-EFI_WIN_NT_PASS_THRU - associates a device with our PCI support
-
- <F>ixed - Fixed disk like a hard drive.
- <R>emovable - Removable media like a floppy or CD-ROM.
- Read <O>nly - Write protected device.
- Read <W>rite - Read write device.
- <block count> - Decimal number of blocks a device supports.
- <block size> - Decimal number of bytes per block.
-
- NT envirnonment variable contents. '<' and '>' are not part of the variable,
- they are just used to make this help more readable. There should be no
- spaces between the ';'. Extra spaces will break the variable. A '!' is
- used to seperate multiple devices in a variable.
-
- EFI_WIN_NT_VIRTUAL_DISKS =
- <F | R><O | W>;<block count>;<block size>[!...]
-
- EFI_WIN_NT_PHYSICAL_DISKS =
- <drive letter>:<F | R><O | W>;<block count>;<block size>[!...]
-
- Virtual Disks: These devices use a file to emulate a hard disk or removable
- media device.
-
- Thus a 20 MB emulated hard drive would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=FW;40960;512
-
- A 1.44MB emulated floppy with a block size of 1024 would look like:
- EFI_WIN_NT_VIRTUAL_DISKS=RW;1440;1024
-
- Physical Disks: These devices use NT to open a real device in your system
-
- Thus a 120 MB floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=B:RW;245760;512
-
- Thus a standard CD-ROM floppy would look like:
- EFI_WIN_NT_PHYSICAL_DISKS=Z:RO;307200;2048
-
- EFI_WIN_NT_FILE_SYSTEM =
- <directory path>[!...]
-
- Mounting the two directories C:\FOO and C:\BAR would look like:
- EFI_WIN_NT_FILE_SYSTEM=c:\foo!c:\bar
-
- EFI_WIN_NT_CONSOLE =
- <window title>
-
- Declaring a text console window with the title "My EFI Console" woild look like:
- EFI_WIN_NT_CONSOLE=My EFI Console
-
- EFI_WIN_NT_UGA =
- <width> <height>[!...]
-
- Declaring a two UGA windows with resolutions of 800x600 and 1024x768 would look like:
- Example : EFI_WIN_NT_UGA=800 600!1024 768
-
- EFI_WIN_NT_SERIAL_PORT =
- <port name>[!...]
-
- Declaring two serial ports on COM1 and COM2 would look like:
- Example : EFI_WIN_NT_SERIAL_PORT=COM1!COM2
-
- EFI_WIN_NT_PASS_THROUGH =
- <BaseAddress>;<Bus#>;<Device#>;<Function#>
-
- Declaring a base address of 0xE0000000 (used for PCI Express devices)
- and having NT32 talk to a device located at bus 0, device 1, function 0:
- Example : EFI_WIN_NT_PASS_THROUGH=E000000;0;1;0
-
----*/
-
-#ifndef __NT_BUS_DRIVER_H__
-#define __NT_BUS_DRIVER_H__
-
-
-
-//
-// WinNt Bus Driver Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBusDriverComponentName;
-
-//
-// WinNt Bus Controller Structure
-//
-#define WIN_NT_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'B', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} WIN_NT_BUS_DEVICE;
-
-//
-// WinNt Child Device Controller Structure
-//
-#define WIN_NT_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'V', 'D')
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE Handle;
- EFI_WIN_NT_IO_PROTOCOL WinNtIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // Private data about the parent
- //
- EFI_HANDLE ControllerHandle;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} WIN_NT_IO_DEVICE;
-
-#define WIN_NT_IO_DEVICE_FROM_THIS(a) \
- CR(a, WIN_NT_IO_DEVICE, WinNtIo, WIN_NT_IO_DEVICE_SIGNATURE)
-
-//
-// This is the largest env variable we can parse
-//
-#define MAX_NT_ENVIRNMENT_VARIABLE_LENGTH 512
-
-typedef struct {
- UINTN Token;
- EFI_GUID *DevicePathGuid;
-} NT_PCD_ENTRY;
-
-typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- UINT32 Instance;
-} WIN_NT_VENDOR_DEVICE_PATH_NODE;
-
-EFI_STATUS
-EFIAPI
-CpuIoInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- SystemTable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Driver Binding Protocol function prototypes
-//
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ParentHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ParentHandle - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-WinNtBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Handle - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// WinNt Bus Driver private worker functions
-//
-EFI_DEVICE_PATH_PROTOCOL *
-WinNtBusCreateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *RootDevicePath,
- IN EFI_GUID *Guid,
- IN UINT16 InstanceNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootDevicePath - TODO: add argument description
- Guid - TODO: add argument description
- InstanceNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-
-#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
deleted file mode 100644
index 2fb7d61aeb..0000000000
--- a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WinNtBusDriver</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>BD7E9A27-D6C5-416a-B245-5F507D95B2BD</GuidValue>
- <Version>1.0</Version>
- <Abstract>Win NT Bus driver</Abstract>
- <Description>This following section documents the envirnoment variables for the Win NT
- build. These variables are used to define the (virtual) hardware
- configuration of the NT environment</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>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.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WinNtBusDriver</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WinNtBusDriver.h</Filename>
- <Filename>WinNtBusDriver.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiWinNtThunkProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gWinNtBusDriverGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtVirtualDisksGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtPhysicalDisksGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtFileSystemGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtSerialPortGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtUgaGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtGopGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtConsoleGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtMemoryGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtCPUModelGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiWinNtCPUSpeedGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gWinNtBusDriverBinding</DriverBinding>
- <ComponentName>gWinNtBusDriverComponentName</ComponentName>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtConsole</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD declares the title string of the text console window.
- such as "My EFI Console".
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtUga</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD declares the resolutions for the UGA windows.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtGop</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD declares the resolutions for the GOP windows.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtSerialPort</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This Pcd declares two serial port for simulated environment.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtFileSystem</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines the windows directory who will be mounted as
- harddisk in simulator.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtVirtualDisk</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines the devices which use a file to emulate a hard disk or
- removable media device
- The item type if this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtPhysicalDisk</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines physical disk which will be simualted as a
- harddisk in simulator.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtCpuModel</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines simulated CPU model string.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtCpuSpeed</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines simulated CPU speed string.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdWinNtMemorySize</C_Name>
- <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This PCD defines the size of simulated memory size.
- The item type of this PCD can only be "DYNAMIC".</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file