Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
32
EdkNt32Pkg/Build/AprioriList.mbd
Normal file
32
EdkNt32Pkg/Build/AprioriList.mbd
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName></BaseName>
|
||||
<Guid>$(EFI_APRIORI_GUID)</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Modified>2006-03-19 15:17</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
44
EdkNt32Pkg/Build/AprioriList.msa
Normal file
44
EdkNt32Pkg/Build/AprioriList.msa
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>AprioriList</BaseName>
|
||||
<ModuleType>USER_DEFINED</ModuleType>
|
||||
<ComponentType>APRIORI</ComponentType>
|
||||
<Guid>0xfc510ee7, 0xffdc, 0x11d4, 0xbd, 0x41, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for creating an Apriori file.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>0</Specification>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Updated>2006-03-19 15:17</Updated>
|
||||
</MsaHeader>
|
||||
<SourceFiles>
|
||||
<Filename>$(BUILD_DIR)\Fv\$(FV).apr</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
</Includes>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
183
EdkNt32Pkg/Build/Nt32Common.xml
Normal file
183
EdkNt32Pkg/Build/Nt32Common.xml
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.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.
|
||||
-->
|
||||
<root>
|
||||
<Ffs type="APPLICATION">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_APPLICATION"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="FILE">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="Apriori">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="Logo, Logo.Logo">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="RAWFILE">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="Legacy16">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="BINARY">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="PE32_PEIM.TE_PEIM">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_TE"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="Config.Config">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="BS_DRIVER.Ifr_Bin">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
|
||||
|
||||
<Ffs type="PEI_CORE">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEI_CORE"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="PE32_PEIM">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="PE32_PEIM.Relocatable">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="PE32_PEIM.CompressPEIM">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="COMBINED_PEIM_DRIVER">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_PEI_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_UNKNOW"/>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="DXE_CORE">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DXE_CORE"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
<Ffs type="BS_DRIVER, RT_DRIVER, SAL_RT_DRIVER, BS_DRIVER_EFI, RT_DRIVER_EFI, APPLICATION_EFI">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections EncapsulationType="Compress">
|
||||
<Sections EncapsulationType="Guid-Defined">
|
||||
<Section SectionType="EFI_SECTION_DXE_DEPEX"/>
|
||||
<Section SectionType="EFI_SECTION_PE32"/>
|
||||
<Section SectionType="EFI_SECTION_USER_INTERFACE"/>
|
||||
<Section SectionType="EFI_SECTION_VERSION"/>
|
||||
</Sections>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
|
||||
<Ffs type="Microcode">
|
||||
<Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_RAW"/>
|
||||
<Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
|
||||
<Sections>
|
||||
<Section SectionType="EFI_SECTION_RAW"/>
|
||||
</Sections>
|
||||
</Ffs>
|
||||
</root>
|
12
EdkNt32Pkg/Build/component.def
Normal file
12
EdkNt32Pkg/Build/component.def
Normal file
@@ -0,0 +1,12 @@
|
||||
; 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.
|
||||
|
||||
LIBRARY
|
||||
EXPORTS
|
||||
InitializeDriver=_ModuleEntryPoint
|
141
EdkNt32Pkg/Dxe/ConPlatform/ComponentName.c
Normal file
141
EdkNt32Pkg/Dxe/ConPlatform/ComponentName.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*++
|
||||
|
||||
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 "ConPlatform.h"
|
||||
#include "ComponentName.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName = {
|
||||
ConPlatformComponentNameGetDriverName,
|
||||
ConPlatformComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
|
||||
{
|
||||
"eng",
|
||||
L"Platform Console Management Driver"
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetDriverName (
|
||||
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,
|
||||
gConPlatformComponentName.SupportedLanguages,
|
||||
mConPlatformDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetControllerName (
|
||||
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.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
44
EdkNt32Pkg/Dxe/ConPlatform/ComponentName.h
Normal file
44
EdkNt32Pkg/Dxe/ConPlatform/ComponentName.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*++
|
||||
|
||||
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.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef CON_MANAGE_COMPONENT_NAME_H_
|
||||
#define CON_MANAGE_COMPONENT_NAME_H_
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
#endif
|
811
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.c
Normal file
811
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.c
Normal file
@@ -0,0 +1,811 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
ConPlatform.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "ConPlatform.h"
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
|
||||
ConPlatformTextInDriverBindingSupported,
|
||||
ConPlatformTextInDriverBindingStart,
|
||||
ConPlatformDriverBindingStop,
|
||||
0x10,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
|
||||
ConPlatformTextOutDriverBindingSupported,
|
||||
ConPlatformTextOutDriverBindingStart,
|
||||
ConPlatformDriverBindingStop,
|
||||
0x10,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
return ConPlatformDriverBindingSupported (
|
||||
This,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath,
|
||||
&gEfiSimpleTextInProtocolGuid
|
||||
);
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
return ConPlatformDriverBindingSupported (
|
||||
This,
|
||||
ControllerHandle,
|
||||
RemainingDevicePath,
|
||||
&gEfiSimpleTextOutProtocolGuid
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Supported
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Supported() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Interface;
|
||||
|
||||
//
|
||||
// Test to see if this is a physical device by checking to see if
|
||||
// it has a Device Path Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
NULL,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Test to see if this device supports the Simple Text Output Protocol
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
ProtocolGuid,
|
||||
(VOID **) &Interface,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
ProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Start() function)
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;
|
||||
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Open the Simple Input Protocol BY_DRIVER
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
(VOID **) &TextIn,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Check the device handle, if it is a hot plug device,
|
||||
// do not put the device path into ConInDev, and install
|
||||
// gEfiConsoleInDeviceGuid to the device handle directly.
|
||||
// The policy is, make hot plug device plug in and play immediately.
|
||||
//
|
||||
if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Append the device path to the ConInDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInpDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
|
||||
//
|
||||
// If the device path is an instance in the ConIn environment variable,
|
||||
// then install EfiConsoleInDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInp,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Start() function)
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
|
||||
|
||||
BOOLEAN NeedClose;
|
||||
|
||||
NeedClose = TRUE;
|
||||
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Open the Simple Text Output Protocol BY_DRIVER
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID **) &TextOut,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Check the device handle, if it is a hot plug device,
|
||||
// do not put the device path into ConOutDev and StdErrDev,
|
||||
// and install gEfiConsoleOutDeviceGuid to the device handle directly.
|
||||
// The policy is, make hot plug device plug in and play immediately.
|
||||
//
|
||||
if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Append the device path to the ConOutDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOutDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
//
|
||||
// Append the device path to the StdErrDev environment variable
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOutDev,
|
||||
DevicePath,
|
||||
APPEND
|
||||
);
|
||||
|
||||
//
|
||||
// If the device path is an instance in the ConOut environment variable,
|
||||
// then install EfiConsoleOutDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOut,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NeedClose = FALSE;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
//
|
||||
// If the device path is an instance in the StdErr environment variable,
|
||||
// then install EfiStandardErrorDeviceGuid onto ControllerHandle
|
||||
//
|
||||
Status = ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOut,
|
||||
DevicePath,
|
||||
CHECK
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NeedClose = FALSE;
|
||||
gBS->InstallMultipleProtocolInterfaces (
|
||||
&ControllerHandle,
|
||||
&gEfiStandardErrorDeviceGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (NeedClose) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
(Standard DriverBinding Protocol Stop() function)
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
//
|
||||
// hot plug device is not included into the console associated variables,
|
||||
// so no need to check variable for those hot plug devices.
|
||||
//
|
||||
if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
|
||||
//
|
||||
// Get the Device Path Protocol so the environment variables can be updated
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &DevicePath,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Remove DevicePath from ConInDev, ConOutDev, and StdErrDev
|
||||
//
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleInpDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarConsoleOutDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
VarErrorOutDev,
|
||||
DevicePath,
|
||||
DELETE
|
||||
);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Uninstall the Console Device GUIDs from Controller Handle
|
||||
//
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiConsoleInDeviceGuid
|
||||
);
|
||||
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiConsoleOutDeviceGuid
|
||||
);
|
||||
|
||||
ConPlatformUnInstallProtocol (
|
||||
This,
|
||||
ControllerHandle,
|
||||
&gEfiStandardErrorDeviceGuid
|
||||
);
|
||||
|
||||
//
|
||||
// Close the Simple Input and Simple Text Output Protocols
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextInProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConPlatformUnInstallProtocol (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Handle,
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
This->DriverBindingHandle,
|
||||
Handle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
Handle,
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID *
|
||||
ConPlatformGetVariable (
|
||||
IN CHAR16 *Name
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Read the EFI variable (Name) and return a dynamically allocated
|
||||
buffer, and the size of the buffer. On failure return NULL.
|
||||
|
||||
Arguments:
|
||||
Name - String part of EFI variable name
|
||||
|
||||
Returns:
|
||||
Dynamically allocated memory that contains a copy of the EFI variable.
|
||||
Caller is repsoncible freeing the buffer.
|
||||
|
||||
NULL - Variable was not read
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Buffer;
|
||||
UINTN BufferSize;
|
||||
|
||||
BufferSize = 0;
|
||||
Buffer = NULL;
|
||||
|
||||
//
|
||||
// Test to see if the variable exists. If it doesn't reuturn NULL
|
||||
//
|
||||
Status = gRT->GetVariable (
|
||||
Name,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
//
|
||||
// Allocate the buffer to return
|
||||
//
|
||||
Status = gBS->AllocatePool (EfiBootServicesData, BufferSize, &Buffer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
//
|
||||
// Read variable into the allocated buffer.
|
||||
//
|
||||
Status = gRT->GetVariable (
|
||||
Name,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (Buffer);
|
||||
Buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Single,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
||||
IN BOOLEAN Delete
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function compares a device path data structure to that of all the nodes of a
|
||||
second device path instance.
|
||||
|
||||
Arguments:
|
||||
Multi - A pointer to a multi-instance device path data structure.
|
||||
|
||||
Single - A pointer to a single-instance device path data structure.
|
||||
|
||||
NewDevicePath - If Delete is TRUE, this parameter must not be null, and it
|
||||
points to the remaining device path data structure.
|
||||
(remaining device path = Multi - Single.)
|
||||
|
||||
Delete - If TRUE, means removing Single from Multi.
|
||||
If FALSE, the routine just check whether Single matches
|
||||
with any instance in Multi.
|
||||
|
||||
Returns:
|
||||
|
||||
The function returns EFI_SUCCESS if the Single is contained within Multi.
|
||||
Otherwise, EFI_NOT_FOUND is returned.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath1;
|
||||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath2;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// The passed in DevicePath should not be NULL
|
||||
//
|
||||
if ((!Multi) || (!Single)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// if performing Delete operation, the NewDevicePath must not be NULL.
|
||||
//
|
||||
TempDevicePath1 = NULL;
|
||||
|
||||
DevicePath = Multi;
|
||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
|
||||
//
|
||||
// search for the match of 'Single' in 'Multi'
|
||||
//
|
||||
while (DevicePathInst) {
|
||||
if (CompareMem (Single, DevicePathInst, Size) == 0) {
|
||||
if (!Delete) {
|
||||
gBS->FreePool (DevicePathInst);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
if (Delete) {
|
||||
TempDevicePath2 = AppendDevicePathInstance (
|
||||
TempDevicePath1,
|
||||
DevicePathInst
|
||||
);
|
||||
gBS->FreePool (TempDevicePath1);
|
||||
TempDevicePath1 = TempDevicePath2;
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (DevicePathInst);
|
||||
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
|
||||
}
|
||||
|
||||
if (Delete) {
|
||||
*NewDevicePath = TempDevicePath1;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONPLATFORM_VAR_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *VariableDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewVariableDevicePath;
|
||||
|
||||
VariableDevicePath = NULL;
|
||||
NewVariableDevicePath = NULL;
|
||||
|
||||
//
|
||||
// Get Variable according to variable name.
|
||||
// The memory for Variable is allocated within ConPlatformGetVarible(),
|
||||
// it is the caller's responsibility to free the memory before return.
|
||||
//
|
||||
VariableDevicePath = ConPlatformGetVariable (VariableName);
|
||||
|
||||
if (Operation != DELETE) {
|
||||
|
||||
Status = ConPlatformMatchDevicePaths (
|
||||
VariableDevicePath,
|
||||
DevicePath,
|
||||
NULL,
|
||||
FALSE
|
||||
);
|
||||
|
||||
if ((Operation == CHECK) || (!EFI_ERROR (Status))) {
|
||||
//
|
||||
// The device path is already in the variable
|
||||
//
|
||||
gBS->FreePool (VariableDevicePath);
|
||||
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// The device path is not in variable. Append DevicePath to the
|
||||
// environment variable that is a multi-instance device path.
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
NewVariableDevicePath = AppendDevicePathInstance (
|
||||
VariableDevicePath,
|
||||
DevicePath
|
||||
);
|
||||
if (NewVariableDevicePath == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// Remove DevicePath from the environment variable that
|
||||
// is a multi-instance device path.
|
||||
//
|
||||
Status = ConPlatformMatchDevicePaths (
|
||||
VariableDevicePath,
|
||||
DevicePath,
|
||||
&NewVariableDevicePath,
|
||||
TRUE
|
||||
);
|
||||
}
|
||||
|
||||
gBS->FreePool (VariableDevicePath);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VariableName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
GetDevicePathSize (NewVariableDevicePath),
|
||||
NewVariableDevicePath
|
||||
);
|
||||
|
||||
gBS->FreePool (NewVariableDevicePath);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsHotPlugDevice (
|
||||
EFI_HANDLE DriverBindingHandle,
|
||||
EFI_HANDLE ControllerHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiHotPlugDeviceGuid,
|
||||
NULL,
|
||||
DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
126
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.h
Normal file
126
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
ConPlatform.h
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef CON_MANAGE_H_
|
||||
#define CON_MANAGE_H_
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
#define VarConsoleInpDev L"ConInDev"
|
||||
#define VarConsoleInp L"ConIn"
|
||||
#define VarConsoleOutDev L"ConOutDev"
|
||||
#define VarConsoleOut L"ConOut"
|
||||
#define VarErrorOutDev L"ErrOutDev"
|
||||
#define VarErrorOut L"ErrOut"
|
||||
|
||||
typedef enum {
|
||||
CHECK,
|
||||
APPEND,
|
||||
DELETE
|
||||
} CONPLATFORM_VAR_OPERATION;
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextInDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformTextOutDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConPlatformDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
VOID
|
||||
ConPlatformUnInstallProtocol (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Handle,
|
||||
IN EFI_GUID *ProtocolGuid
|
||||
);
|
||||
|
||||
VOID *
|
||||
ConPlatformGetVariable (
|
||||
IN CHAR16 *Name
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformMatchDevicePaths (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Multi,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * Single,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
|
||||
IN BOOLEAN Delete
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ConPlatformUpdateDeviceVariable (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
IN CONPLATFORM_VAR_OPERATION Operation
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
IsHotPlugDevice (
|
||||
EFI_HANDLE DriverBindingHandle,
|
||||
EFI_HANDLE ControllerHandle
|
||||
);
|
||||
|
||||
#endif
|
44
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.mbd
Normal file
44
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.mbd
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>ConPlatform</BaseName>
|
||||
<Guid>51ccf399-4fdf-4e55-a45b-e123f84d456a</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>
|
||||
<Created>2006-03-13 17:06</Created>
|
||||
<Modified>2006-03-19 15:17</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiRuntimeServicesTableLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>UefiDriverModelLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkDxePrintLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
</Libraries>
|
||||
</ModuleBuildDescription>
|
116
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.msa
Normal file
116
EdkNt32Pkg/Dxe/ConPlatform/ConPlatform.msa
Normal file
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>ConPlatform</BaseName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>51ccf399-4fdf-4e55-a45b-e123f84d456a</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DiskIo module.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>0</Specification>
|
||||
<Created>2006-03-13 17:06</Created>
|
||||
<Updated>2006-03-19 15:17</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverModelLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiRuntimeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>ConPlatform.c</Filename>
|
||||
<Filename>ConPlatform.h</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">SimpleTextOut</Protocol>
|
||||
<Protocol Usage="TO_START">SimpleTextIn</Protocol>
|
||||
<Protocol Usage="TO_START">DevicePath</Protocol>
|
||||
</Protocols>
|
||||
<Variables>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ConInDev</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ConIn</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ConOutDev</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ConOut</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ErrOutDev</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
<Variable Usage="SOMETIMES_CONSUMED">
|
||||
<String>ErrOut</String>
|
||||
<Guid>0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C</Guid>
|
||||
</Variable>
|
||||
</Variables>
|
||||
<Guids>
|
||||
<GuidEntry Usage="SOMETIMES_PRODUCED">
|
||||
<C_Name>ConsoleInDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_PRODUCED">
|
||||
<C_Name>ConsoleOutDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_PRODUCED">
|
||||
<C_Name>StandardErrorDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>HotPlugDevice</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>GlobalVariable</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint></ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gConPlatformTextInDriverBinding</DriverBinding>
|
||||
<ComponentName>gConPlatformComponentName</ComponentName>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gConPlatformTextOutDriverBinding</DriverBinding>
|
||||
<ComponentName>gConPlatformComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkNt32Pkg/Dxe/ConPlatform/build.xml
Normal file
47
EdkNt32Pkg/Dxe/ConPlatform/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- 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.-->
|
||||
<project basedir="." default="ConPlatform"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Dxe\ConPlatform"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="ConPlatform">
|
||||
<GenBuild baseName="ConPlatform" mbdFilename="${MODULE_DIR}\ConPlatform.mbd" msaFilename="${MODULE_DIR}\ConPlatform.msa"/>
|
||||
</target>
|
||||
<target depends="ConPlatform_clean" name="clean"/>
|
||||
<target depends="ConPlatform_cleanall" name="cleanall"/>
|
||||
<target name="ConPlatform_clean">
|
||||
<OutputDirSetup baseName="ConPlatform" mbdFilename="${MODULE_DIR}\ConPlatform.mbd" msaFilename="${MODULE_DIR}\ConPlatform.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\ConPlatform_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\ConPlatform_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="ConPlatform_cleanall">
|
||||
<OutputDirSetup baseName="ConPlatform" mbdFilename="${MODULE_DIR}\ConPlatform.mbd" msaFilename="${MODULE_DIR}\ConPlatform.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\ConPlatform_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\ConPlatform_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**ConPlatform*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
Binary file not shown.
@@ -0,0 +1,57 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscBaseBoardManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_SERIAL_NUMBER),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_ASSET_TAG),
|
||||
STRING_TOKEN(STR_MISC_BASE_BOARD_CHASSIS_LOCATION),
|
||||
{ // BaseBoardFeatureFlags
|
||||
1, // Motherboard
|
||||
0, // RequiresDaughterCard
|
||||
0, // Removable
|
||||
1, // Replaceable,
|
||||
0, // HotSwappable
|
||||
0, // Reserved
|
||||
},
|
||||
EfiBaseBoardTypeUnknown, // BaseBoardType
|
||||
{ // BaseBoardChassisLink
|
||||
EFI_MISC_SUBCLASS_GUID, // ProducerName
|
||||
1, // Instance
|
||||
1, // SubInstance
|
||||
},
|
||||
0, // BaseBoardNumberLinks
|
||||
{ // LinkN
|
||||
EFI_MISC_SUBCLASS_GUID, // ProducerName
|
||||
1, // Instance
|
||||
1, // SubInstance
|
||||
},
|
||||
};
|
||||
|
||||
/* eof - MiscBaseBoardManufacturerData.c */
|
@@ -0,0 +1,45 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscBiosLanguageData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLangauges) = {
|
||||
1, // NumberOfInstallableLanguages
|
||||
{ // LanguageFlags
|
||||
0, // AbbreviatedLanguageFormat
|
||||
0 // Reserved
|
||||
},
|
||||
0 // CurrentLanguageNumber
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
|
||||
0, // LanguageId
|
||||
STR_MISC_SYSTEM_LANGUAGE_STRING // SystemLanguageString
|
||||
};
|
||||
|
||||
/* eof - MiscBiosLanguageData.c */
|
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendor.uni
Normal file
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscBiosVendor.uni
Normal file
Binary file not shown.
@@ -0,0 +1,88 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscBiosVendorData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {
|
||||
STRING_TOKEN(STR_MISC_BIOS_VENDOR), // BiosVendor
|
||||
STRING_TOKEN(STR_MISC_BIOS_VERSION), // BiosVersion
|
||||
STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate
|
||||
0xBABE, // BiosStartingAddress
|
||||
{ // BiosPhysicalDeviceSize
|
||||
2, // Value
|
||||
3, // Exponent
|
||||
},
|
||||
{ // BiosCharacteristics1
|
||||
0, // Reserved1 :2
|
||||
0, // Unknown :1
|
||||
1, // BiosCharacteristicsNotSupported :1
|
||||
0, // IsaIsSupported :1
|
||||
0, // McaIsSupported :1
|
||||
0, // EisaIsSupported :1
|
||||
0, // PciIsSupported :1
|
||||
0, // PcmciaIsSupported :1
|
||||
0, // PlugAndPlayIsSupported :1
|
||||
0, // ApmIsSupported :1
|
||||
0, // BiosIsUpgradable :1
|
||||
0, // BiosShadowingAllowed :1
|
||||
0, // VlVesaIsSupported :1
|
||||
0, // EscdSupportIsAvailable :1
|
||||
0, // BootFromCdIsSupported :1
|
||||
0, // SelectableBootIsSupported :1
|
||||
0, // RomBiosIsSocketed :1
|
||||
0, // BootFromPcmciaIsSupported :1
|
||||
0, // EDDSpecificationIsSupported :1
|
||||
0, // JapaneseNecFloppyIsSupported :1
|
||||
0, // JapaneseToshibaFloppyIsSupported :1
|
||||
0, // Floppy525_360IsSupported :1
|
||||
0, // Floppy525_12IsSupported :1
|
||||
0, // Floppy35_720IsSupported :1
|
||||
0, // Floppy35_288IsSupported :1
|
||||
0, // PrintScreenIsSupported :1
|
||||
0, // Keyboard8042IsSupported :1
|
||||
0, // SerialIsSupported :1
|
||||
0, // PrinterIsSupported :1
|
||||
0, // CgaMonoIsSupported :1
|
||||
0, // NecPc98 :1
|
||||
0, // AcpiIsSupported :1
|
||||
0, // UsbLegacyIsSupported :1
|
||||
0, // AgpIsSupported :1
|
||||
0, // I20BootIsSupported :1
|
||||
0, // Ls120BootIsSupported :1
|
||||
0, // AtapiZipDriveBootIsSupported :1
|
||||
0, // Boot1394IsSupported :1
|
||||
0, // SmartBatteryIsSupported :1
|
||||
0, // BiosBootSpecIsSupported :1
|
||||
0, // FunctionKeyNetworkBootIsSupported :1
|
||||
0 // Reserved :22
|
||||
},
|
||||
{ // BiosCharacteristics2
|
||||
0, // BiosReserved :16
|
||||
0, // SystemReserved :16
|
||||
0 // Reserved :32
|
||||
},
|
||||
};
|
||||
|
||||
/* eof - MiscBiosVendorData.c */
|
@@ -0,0 +1,33 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscBootInformationData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {
|
||||
EfiBootInformationStatusNoError, // BootInformationStatus
|
||||
0 // BootInformationData
|
||||
};
|
||||
|
||||
/* eof - MiscBootInformationData.c */
|
Binary file not shown.
@@ -0,0 +1,45 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscChassisManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Chassis Manufacturer data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER), // ChassisManufactrurer
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_VERSION), // ChassisVersion
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber
|
||||
STRING_TOKEN(STR_MISC_CHASSIS_ASSET_TAG), // ChassisAssetTag
|
||||
{ // ChassisTypeStatus
|
||||
EfiMiscChassisTypeOther, // ChassisType
|
||||
0, // ChassisLockPresent
|
||||
0 // Reserved
|
||||
},
|
||||
EfiChassisStateOther, // ChassisBootupState
|
||||
EfiChassisStateOther, // ChassisPowerSupplyState
|
||||
EfiChassisStateOther, // ChassisThermalState
|
||||
EfiChassisSecurityStatusOther, // ChassisSecurityState
|
||||
0 // ChassisOemDefined
|
||||
};
|
||||
|
||||
/* eof - MiscChassisManufacaturerData.c */
|
175
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscDevicePath.h
Normal file
175
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscDevicePath.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscDevicePath.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Misc class required EFI Device Path definitions (Ports, slots &
|
||||
onboard devices)
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _MISC_DEVICE_PATH_H
|
||||
#define _MISC_DEVICE_PATH_H
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
// USB
|
||||
//
|
||||
|
||||
/* For reference:
|
||||
#define USB1_1_STR "ACPI(PNP0A03,0)/PCI(1D,0)."
|
||||
#define USB1_2_STR "ACPI(PNP0A03,0)/PCI(1D,1)."
|
||||
#define USB1_3_STR "ACPI(PNP0A03,0)/PCI(1D,2)."
|
||||
#define USB2_1_STR "ACPI(PNP0A03,0)/PCI(1D,7)."
|
||||
*/
|
||||
|
||||
//
|
||||
// #define acpi { 0x02, 0x01, 0x00, 0x0C, 0x0a0341d0, 0x00000000 }
|
||||
// #define pci( device,function) { 0x01, 0x01, 0x00, 0x06, device, function }
|
||||
// #define end { 0xFF, 0xFF, 0x00, 0x04 }
|
||||
//
|
||||
#define ACPI \
|
||||
{ \
|
||||
ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (0x0A03), 0 \
|
||||
}
|
||||
#define PCI(device, function) \
|
||||
{ \
|
||||
HARDWARE_DEVICE_PATH, HW_PCI_DP, (UINT8) (sizeof (PCI_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (PCI_DEVICE_PATH)) >> 8), function, device \
|
||||
}
|
||||
#define END \
|
||||
{ \
|
||||
END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, END_DEVICE_PATH_LENGTH, 0 \
|
||||
}
|
||||
|
||||
#define LPC(eisaid, function) \
|
||||
{ \
|
||||
ACPI_DEVICE_PATH, ACPI_DP, (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), (UINT8) \
|
||||
((sizeof (ACPI_HID_DEVICE_PATH)) >> 8), EISA_PNP_ID (eisaid), function \
|
||||
}
|
||||
|
||||
//
|
||||
// Shanmu >> moved to TianoDevicePath.h
|
||||
//
|
||||
|
||||
/*
|
||||
typedef struct _USB_PORT_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} USB_PORT_DEVICE_PATH;
|
||||
|
||||
|
||||
//IDE ??I am not sure. Should this be ATAPI_DEVICE_PATH
|
||||
typedef struct _IDE_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} IDE_DEVICE_PATH;
|
||||
|
||||
//RMC Connector
|
||||
typedef struct _RMC_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} RMC_CONN_DEVICE_PATH;
|
||||
|
||||
//static RMC_CONN_DEVICE_PATH mRmcConnDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x0A,0x00 ), end };
|
||||
|
||||
//RIDE
|
||||
typedef struct _RIDE_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
PCI_DEVICE_PATH PciBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} RIDE_DEVICE_PATH;
|
||||
|
||||
//static RIDE_DEVICE_PATH mRideDevicePath = { acpi, pci( 0x1E,0x00 ),pci( 0x02,0x00 ), end };
|
||||
|
||||
//Gigabit NIC
|
||||
//typedef struct _GB_NIC_DEVICE_PATH
|
||||
//{
|
||||
// ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciXBridgeDevicePath;
|
||||
// PCI_DEVICE_PATH PciXBusDevicePath;
|
||||
// EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
//} GB_NIC_DEVICE_PATH;
|
||||
|
||||
//static GB_NIC_DEVICE_PATH mGbNicDevicePath = { acpi, pci( 0x03,0x00 ),pci( 0x1F,0x00 ),pci( 0x07,0x00 ), end };
|
||||
|
||||
|
||||
//P/S2 Connector
|
||||
typedef struct _PS2_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} PS2_CONN_DEVICE_PATH;
|
||||
|
||||
//static PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,0 ), end };
|
||||
//static PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0303,1 ), end };
|
||||
|
||||
//Serial Port Connector
|
||||
typedef struct _SERIAL_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} SERIAL_CONN_DEVICE_PATH;
|
||||
|
||||
//static SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,0 ), end };
|
||||
//static SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0501,1 ), end };
|
||||
|
||||
//Parallel Port Connector
|
||||
typedef struct _PARALLEL_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} PARALLEL_CONN_DEVICE_PATH;
|
||||
|
||||
//static PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0401,0 ), end };
|
||||
|
||||
//Floopy Connector
|
||||
typedef struct _FLOOPY_CONN_DEVICE_PATH
|
||||
{
|
||||
ACPI_HID_DEVICE_PATH PciRootBridgeDevicePath;
|
||||
PCI_DEVICE_PATH LpcBridgeDevicePath;
|
||||
ACPI_HID_DEVICE_PATH LpcBusDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
|
||||
} FLOOPY_CONN_DEVICE_PATH;
|
||||
|
||||
//static FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,0 ), end };
|
||||
//static FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { acpi, pci( 0x1F,0x00 ),lpc( 0x0604,1 ), end };
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// End Shanmu
|
||||
//
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
@@ -0,0 +1,37 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscNumberOfInstallableLanguagesData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages) = {
|
||||
1, // NumberOfInstallableLanguages
|
||||
{ // LanguageFlags
|
||||
0, // AbbreviatedLanguageFormat
|
||||
0 // Reserved
|
||||
},
|
||||
0, // CurrentLanguageNumber
|
||||
};
|
||||
|
||||
/* eof - MiscNumberOfInstallableLanguagesData.c */
|
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemString.uni
Normal file
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemString.uni
Normal file
Binary file not shown.
32
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemStringData.c
Normal file
32
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOemStringData.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscOemStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {
|
||||
STRING_TOKEN(STR_MISC_OEM_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscOemStringData.c */
|
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOnboardDevice.uni
Normal file
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscOnboardDevice.uni
Normal file
Binary file not shown.
@@ -0,0 +1,36 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscOnboardDeviceData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_ONBOARD_DEVICE_DATA, MiscOnboardDevice) = {
|
||||
STRING_TOKEN(STR_MISC_ONBOARD_DEVICE_DESCRIPTION), // OnBoardDeviceDescription
|
||||
{ // OnBoardDeviceStatus
|
||||
EfiOnBoardDeviceTypeOther, // DeviceType
|
||||
0, // DeviceEnabled
|
||||
0 // Reserved
|
||||
},
|
||||
0 // OnBoardDevicePath
|
||||
};
|
@@ -0,0 +1,164 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscOnboardDeviceFunction.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Onboard device information boot time changes.
|
||||
Misc. subclass type 8.
|
||||
SMBIOS type 10.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
#include "winntio/winntio.h"
|
||||
#include "winntthunk/winntthunk.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct _VENDOR_DEVICE {
|
||||
EFI_DEVICE_PATH_PROTOCOL Platform;
|
||||
EFI_GUID PlatformGuid;
|
||||
EFI_DEVICE_PATH_PROTOCOL Device;
|
||||
EFI_GUID DeviceGuid;
|
||||
UINT8 DeviceData[4];
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
|
||||
} VENDOR_DEVICE;
|
||||
#pragma pack()
|
||||
|
||||
MISC_SUBCLASS_TABLE_FUNCTION (
|
||||
MiscOnboardDeviceVideo
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscOnboardDevice structure.
|
||||
|
||||
Parameters:
|
||||
|
||||
RecordType
|
||||
Type of record to be processed from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordType
|
||||
|
||||
RecordLen
|
||||
Size of static RecordData from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordLen
|
||||
|
||||
RecordData
|
||||
Pointer to copy of RecordData from the Data Table. Changes made
|
||||
to this copy will be written to the Data Hub but will not alter
|
||||
the contents of the static Data Table.
|
||||
|
||||
LogRecordData
|
||||
Set *LogRecordData to TRUE to log RecordData to Data Hub.
|
||||
Set *LogRecordData to FALSE when there is no more data to log.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
All parameters were valid and *RecordData and *LogRecordData have
|
||||
been set.
|
||||
|
||||
EFI_UNSUPPORTED
|
||||
Unexpected RecordType value.
|
||||
|
||||
EFI_INVALID_PARAMETER
|
||||
One of the following parameter conditions was true:
|
||||
RecordLen was zero.
|
||||
RecordData was NULL.
|
||||
LogRecordData was NULL.
|
||||
--*/
|
||||
{
|
||||
STATIC VENDOR_DEVICE mVideoDevicePath = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
0x14
|
||||
},
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID,
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
0x18
|
||||
},
|
||||
EFI_WIN_NT_UGA_GUID,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
END
|
||||
};
|
||||
|
||||
STATIC BOOLEAN Done = FALSE;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Then check for unsupported RecordType.
|
||||
//
|
||||
if (RecordType != EFI_MISC_ONBOARD_DEVICE_DATA_RECORD_NUMBER) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Is this the first time through this function?
|
||||
//
|
||||
if (!Done) {
|
||||
//
|
||||
// Yes, this is the first time. Inspect/Change the contents of the
|
||||
// RecordData structure.
|
||||
//
|
||||
//
|
||||
// Any time changes?
|
||||
//
|
||||
// %%TBD
|
||||
//
|
||||
// Set Done flag to TRUE for next pass through this function.
|
||||
// Set *LogRecordData to TRUE so data will get logged to Data Hub.
|
||||
//
|
||||
switch (((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDeviceDescription) {
|
||||
case STR_MISC_ONBOARD_DEVICE_VIDEO_DESCRIPTION:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData)->OnBoardDevicePath,
|
||||
&mVideoDevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_DEVICE_PATH_PROTOCOL) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mVideoDevicePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Done = TRUE;
|
||||
*LogRecordData = TRUE;
|
||||
} else {
|
||||
//
|
||||
// No, this is the second time. Reset the state of the Done flag
|
||||
// to FALSE and tell the data logger that there is no more data
|
||||
// to be logged for this record type. If any memory allocations
|
||||
// were made by earlier passes, they must be released now.
|
||||
//
|
||||
Done = FALSE;
|
||||
*LogRecordData = FALSE;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/* eof - MiscOnboardDeviceFunction.c */
|
Binary file not shown.
@@ -0,0 +1,99 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscPortInternalConnectorDesignatorData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeOther, // PortInternalConnectorType
|
||||
EfiPortConnectorTypeOther, // PortExternalConnectorType
|
||||
EfiPortTypeNone, // PortType
|
||||
0 // PortPath
|
||||
};
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {
|
||||
STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_KEYBOARD), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeNone, // PortInternalConnectorType
|
||||
EfiPortConnectorTypePS2, // PortExternalConnectorType
|
||||
EfiPortTypeKeyboard, // PortType
|
||||
// mPs2KbyboardDevicePath // PortPath
|
||||
//
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {
|
||||
STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE), // PortInternalConnectorDesignator
|
||||
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_MOUSE), // PortExternalConnectorDesignator
|
||||
EfiPortConnectorTypeNone, // PortInternalConnectorType
|
||||
EfiPortConnectorTypePS2, // PortExternalConnectorType
|
||||
EfiPortTypeMouse, // PortType
|
||||
// mPs2MouseDevicePath // PortPath
|
||||
//
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM1),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1),
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortConnectorTypeDB9Female,
|
||||
EfiPortTypeSerial16550ACompatible,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM2),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2),
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortConnectorTypeDB9Female,
|
||||
EfiPortTypeSerial16550ACompatible,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_EXTENSION_POWER),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER),
|
||||
EfiPortConnectorTypeOther,
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortTypeOther,
|
||||
0
|
||||
};
|
||||
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {
|
||||
STRING_TOKEN(STR_MISC_PORT_INTERNAL_FLOPPY),
|
||||
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY),
|
||||
EfiPortConnectorTypeOnboardFloppy,
|
||||
EfiPortConnectorTypeNone,
|
||||
EfiPortTypeOther,
|
||||
0
|
||||
};
|
||||
|
||||
/* eof - MiscPortInternalConnectorDesignatorData.c */
|
@@ -0,0 +1,266 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscPortInternalConnectorDesignatorFunction.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_FUNCTION (
|
||||
MiscPortInternalConnectorDesignator
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscPortConnectorInformation (Type 8).
|
||||
|
||||
Parameters:
|
||||
|
||||
RecordType
|
||||
Type of record to be processed from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordType
|
||||
|
||||
RecordLen
|
||||
Size of static RecordData from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordLen
|
||||
|
||||
RecordData
|
||||
Pointer to copy of RecordData from the Data Table. Changes made
|
||||
to this copy will be written to the Data Hub but will not alter
|
||||
the contents of the static Data Table.
|
||||
|
||||
LogRecordData
|
||||
Set *LogRecordData to TRUE to log RecordData to Data Hub.
|
||||
Set *LogRecordData to FALSE when there is no more data to log.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
All parameters were valid and *RecordData and *LogRecordData have
|
||||
been set.
|
||||
|
||||
EFI_UNSUPPORTED
|
||||
Unexpected RecordType value.
|
||||
|
||||
EFI_INVALID_PARAMETER
|
||||
One of the following parameter conditions was true:
|
||||
RecordLen was zero.
|
||||
RecordData was NULL.
|
||||
LogRecordData was NULL.
|
||||
--*/
|
||||
{
|
||||
STATIC BOOLEAN Done = FALSE;
|
||||
STATIC PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0303, 0), END };
|
||||
STATIC PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0303, 1), END };
|
||||
STATIC SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0501, 0), END };
|
||||
STATIC SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0501, 1), END };
|
||||
STATIC PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0401, 0), END };
|
||||
STATIC FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0604, 0), END };
|
||||
STATIC FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { ACPI, PCI (0x1F, 0x00), LPC (0x0604, 1), END };
|
||||
STATIC USB_PORT_DEVICE_PATH mUsb0DevicePath = { ACPI, PCI (0x1d, 0x00), END };
|
||||
STATIC USB_PORT_DEVICE_PATH mUsb1DevicePath = { ACPI, PCI (0x1d, 0x01), END };
|
||||
STATIC USB_PORT_DEVICE_PATH mUsb2DevicePath = { ACPI, PCI (0x1d, 0x02), END };
|
||||
STATIC USB_PORT_DEVICE_PATH mUsb3DevicePath = { ACPI, PCI (0x1d, 0x07), END };
|
||||
STATIC IDE_DEVICE_PATH mIdeDevicePath = { ACPI, PCI (0x1F, 0x01), END };
|
||||
STATIC GB_NIC_DEVICE_PATH mGbNicDevicePath = { ACPI, PCI( 0x03,0x00 ),PCI( 0x1F,0x00 ),PCI( 0x07,0x00 ), END };
|
||||
EFI_DEVICE_PATH_PROTOCOL EndDevicePath = END;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
// Shanmu >> to fix the Device Path Issue...
|
||||
// if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
|
||||
//
|
||||
if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
|
||||
//
|
||||
// End Shanmu
|
||||
//
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Then check for unsupported RecordType.
|
||||
//
|
||||
if (RecordType != EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Is this the first time through this function?
|
||||
//
|
||||
if (!Done) {
|
||||
//
|
||||
// Yes, this is the first time. Inspect/Change the contents of the
|
||||
// RecordData structure.
|
||||
//
|
||||
//
|
||||
// Device path is only updated here as it was not taking that in static data
|
||||
//
|
||||
// Shanmu >> to fix the Device Path Issue...
|
||||
//
|
||||
|
||||
/*
|
||||
switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator)
|
||||
{
|
||||
case STR_MISC_PORT_INTERNAL_MOUSE:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_KEYBOARD:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_COM1:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_COM2:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_LPT1:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_USB1:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_USB2:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_USB3:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_NETWORK:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_FLOPPY:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_IDE1:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
|
||||
}break;
|
||||
case STR_MISC_PORT_INTERNAL_IDE2:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;
|
||||
}break;
|
||||
}
|
||||
*/
|
||||
switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortInternalConnectorDesignator) {
|
||||
case STR_MISC_PORT_INTERNAL_MOUSE:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&mPs2MouseDevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath);
|
||||
}
|
||||
break;
|
||||
|
||||
case STR_MISC_PORT_INTERNAL_KEYBOARD:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&mPs2KeyboardDevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath);
|
||||
}
|
||||
break;
|
||||
|
||||
case STR_MISC_PORT_INTERNAL_COM1:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&mCom1DevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath);
|
||||
}
|
||||
break;
|
||||
|
||||
case STR_MISC_PORT_INTERNAL_COM2:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&mCom2DevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath);
|
||||
}
|
||||
break;
|
||||
|
||||
case STR_MISC_PORT_INTERNAL_FLOPPY:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&mFloopyADevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
CopyMem (
|
||||
&((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
|
||||
&EndDevicePath,
|
||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath)
|
||||
);
|
||||
*RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//
|
||||
// End Shanmu
|
||||
//
|
||||
// Set Done flag to TRUE for next pass through this function.
|
||||
// Set *LogRecordData to TRUE so data will get logged to Data Hub.
|
||||
//
|
||||
Done = TRUE;
|
||||
*LogRecordData = TRUE;
|
||||
} else {
|
||||
//
|
||||
// No, this is the second time. Reset the state of the Done flag
|
||||
// to FALSE and tell the data logger that there is no more data
|
||||
// to be logged for this record type. If any memory allocations
|
||||
// were made by earlier passes, they must be released now.
|
||||
//
|
||||
Done = FALSE;
|
||||
*LogRecordData = FALSE;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/* eof - MiscSystemManufacturerFunction.c */
|
@@ -0,0 +1,42 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscResetCapabilitiesData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {
|
||||
{ // ResetCapabilities
|
||||
0, // Status
|
||||
0, // BootOption
|
||||
0, // BootOptionOnLimit
|
||||
0, // WatchdogTimerPresent
|
||||
0 // Reserved
|
||||
},
|
||||
0, // ResetCount
|
||||
0, // ResetLimit
|
||||
0, // ResetTimerInterval
|
||||
0 // ResetTimeout
|
||||
};
|
||||
|
||||
/* eof - MiscResetCapabilities.c */
|
@@ -0,0 +1,27 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSubclassDriver.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression file for MiscSubclass Driver.
|
||||
|
||||
--*/
|
||||
|
||||
#include <AutoGen.h>
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
EFI_DATA_HUB_PROTOCOL_GUID AND EFI_HII_PROTOCOL_GUID
|
||||
DEPENDENCY_END
|
104
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.h
Normal file
104
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSubclassDriver.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Header file for MiscSubclass Driver.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _MISC_SUBCLASS_DRIVER_H
|
||||
#define _MISC_SUBCLASS_DRIVER_H
|
||||
|
||||
|
||||
#include <MiscDevicePath.h>
|
||||
|
||||
//
|
||||
// Autogen string file
|
||||
//
|
||||
#include <MiscSubclassStrDefs.h>
|
||||
|
||||
//
|
||||
// Data table entry update function.
|
||||
//
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI EFI_MISC_SUBCLASS_DATA_FUNCTION) (
|
||||
IN UINT16 RecordType,
|
||||
IN UINT32 *RecordLen,
|
||||
IN OUT EFI_MISC_SUBCLASS_RECORDS *RecordData,
|
||||
OUT BOOLEAN *LogRecordData
|
||||
);
|
||||
|
||||
//
|
||||
// Data table entry definition.
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 RecordType;
|
||||
UINT32 RecordLen;
|
||||
VOID *RecordData;
|
||||
EFI_MISC_SUBCLASS_DATA_FUNCTION *Function;
|
||||
} EFI_MISC_SUBCLASS_DATA_TABLE;
|
||||
|
||||
//
|
||||
// Data Table extern definitions.
|
||||
//
|
||||
#define MISC_SUBCLASS_TABLE_EXTERNS(NAME1, NAME2) \
|
||||
extern NAME1 NAME2 ## Data; \
|
||||
extern EFI_MISC_SUBCLASS_DATA_FUNCTION NAME2 ## Function
|
||||
|
||||
//
|
||||
// Data Table entries
|
||||
//
|
||||
#define MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(NAME1, NAME2) { \
|
||||
NAME1 ## _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, NULL \
|
||||
}
|
||||
|
||||
#define MISC_SUBCLASS_TABLE_ENTRY_FUNCTION_ONLY(NAME1, NAME2) \
|
||||
{ \
|
||||
NAME1 ## _RECORD_NUMBER, 0, NULL, &NAME2 ## Function \
|
||||
}
|
||||
|
||||
#define MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2, NAME3) \
|
||||
{ \
|
||||
NAME1 ## _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, &NAME3 ## Function \
|
||||
}
|
||||
|
||||
//
|
||||
// Global definition macros.
|
||||
//
|
||||
#define MISC_SUBCLASS_TABLE_DATA(NAME1, NAME2) NAME1 NAME2 ## Data
|
||||
|
||||
#define MISC_SUBCLASS_TABLE_FUNCTION(NAME2) \
|
||||
EFI_STATUS EFIAPI NAME2 ## Function ( \
|
||||
IN UINT16 RecordType, \
|
||||
IN UINT32 *RecordLen, \
|
||||
IN OUT EFI_MISC_SUBCLASS_RECORDS * RecordData, \
|
||||
OUT BOOLEAN *LogRecordData \
|
||||
)
|
||||
|
||||
//
|
||||
// Data Table Array
|
||||
//
|
||||
extern EFI_MISC_SUBCLASS_DATA_TABLE mMiscSubclassDataTable[];
|
||||
|
||||
//
|
||||
// Data Table Array Entries
|
||||
//
|
||||
extern UINTN mMiscSubclassDataTableEntries;
|
||||
|
||||
#endif /* _MISC_SUBCLASS_DRIVER_H */
|
||||
|
||||
/* eof - MiscSubclassDriver.h */
|
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>MiscSubclass</BaseName>
|
||||
<Guid>4A9B9DB8-EC62-4A92-818F-8AA0246D246E</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2006, 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>
|
||||
<Created>2006-03-13 17:07</Created>
|
||||
<Modified>2006-03-23 13:50</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>HiiLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
114
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa
Normal file
114
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.msa
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>MiscSubclass</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>4A9B9DB8-EC62-4A92-818F-8AA0246D246E</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for MiscSubclass Driver module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2006, 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>0</Specification>
|
||||
<Created>2006-03-13 17:07</Created>
|
||||
<Updated>2006-03-23 13:50</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HiiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>MiscSubclassDriver.uni</Filename>
|
||||
<Filename>MiscSubclassDriver.h</Filename>
|
||||
<Filename>MiscSubclassDriverEntryPoint.c</Filename>
|
||||
<Filename>MiscSubclassDriverDataTable.c</Filename>
|
||||
<Filename>MiscBaseBoardManufacturerData.c</Filename>
|
||||
<Filename>MiscBiosVendorData.c</Filename>
|
||||
<Filename>MiscBootInformationData.c</Filename>
|
||||
<Filename>MiscChassisManufacturerData.c</Filename>
|
||||
<Filename>MiscNumberOfInstallableLanguagesData.c</Filename>
|
||||
<Filename>MiscOemStringData.c</Filename>
|
||||
<Filename>MiscOnboardDeviceData.c</Filename>
|
||||
<Filename>MiscPortInternalConnectorDesignatorData.c</Filename>
|
||||
<Filename>MiscResetCapabilitiesData.c</Filename>
|
||||
<Filename>MiscSystemLanguageStringData.c</Filename>
|
||||
<Filename>MiscSystemManufacturerData.c</Filename>
|
||||
<Filename>MiscSystemManufacturerFunction.c</Filename>
|
||||
<Filename>MiscSystemOptionStringData.c</Filename>
|
||||
<Filename>MiscSystemSlotDesignationData.c</Filename>
|
||||
<Filename>MiscPortInternalConnectorDesignatorFunction.c</Filename>
|
||||
<Filename>MiscSubclassDriver.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
<PackageName>EdkNt32Pkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DataHub</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">Hii</Protocol>
|
||||
<ProtocolNotify Usage="SOMETIMES_CONSUMED">WinNtIo</ProtocolNotify>
|
||||
</Protocols>
|
||||
<DataHubs>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscPortKeyboard</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscPortMouse</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscPortCom1</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscPortCom2</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscBiosVendor</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscSystemManufacturer</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscBaseBoardManufacturer</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscChassisManufacturer</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">MiscSystemSlotDesignation</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">OemString</DataHubRecord>
|
||||
<DataHubRecord Usage="ALWAYS_PRODUCED">SystemOptionString</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">ProcessorSubClassData</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_PRODUCED">MemorySubClassData</DataHubRecord>
|
||||
</DataHubs>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>MiscSubClass</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>ProcessorSubClass</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>MemoryProducer</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>MemorySubClass</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="SOMETIMES_CONSUMED">
|
||||
<C_Name>WinNtMemory</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>MiscSubclassDriverEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.uni
Normal file
BIN
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/MiscSubclassDriver.uni
Normal file
Binary file not shown.
@@ -0,0 +1,103 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSubclassDriverDataTable.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// External definitions referenced by Data Table entries.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_CHASSIS_MANUFACTURER_DATA,
|
||||
MiscChassisManufacturer
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_BIOS_VENDOR_DATA,
|
||||
MiscBiosVendor
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_SYSTEM_MANUFACTURER_DATA,
|
||||
MiscSystemManufacturer
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_BASE_BOARD_MANUFACTURER_DATA,
|
||||
MiscBaseBoardManufacturer
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
|
||||
MiscPortInternalConnectorDesignator
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
|
||||
MiscPortKeyboard
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
|
||||
MiscPortMouse
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
|
||||
MiscPortCom1
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
|
||||
MiscPortCom2
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA,
|
||||
MiscSystemSlotDesignation
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_ONBOARD_DEVICE_DATA,
|
||||
MiscOnboardDevice
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_OEM_STRING_DATA,
|
||||
OemString
|
||||
);
|
||||
MISC_SUBCLASS_TABLE_EXTERNS (
|
||||
EFI_MISC_SYSTEM_OPTION_STRING_DATA,
|
||||
SystemOptionString
|
||||
);
|
||||
|
||||
//
|
||||
// Data Table.
|
||||
//
|
||||
EFI_MISC_SUBCLASS_DATA_TABLE mMiscSubclassDataTable[] = {
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortKeyboard, MiscPortInternalConnectorDesignator),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortMouse, MiscPortInternalConnectorDesignator),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom1, MiscPortInternalConnectorDesignator),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom2, MiscPortInternalConnectorDesignator),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BIOS_VENDOR, MiscBiosVendor),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_MANUFACTURER, MiscSystemManufacturer),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BASE_BOARD_MANUFACTURER, MiscBaseBoardManufacturer),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_CHASSIS_MANUFACTURER, MiscChassisManufacturer),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_SLOT_DESIGNATION, MiscSystemSlotDesignation),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_OEM_STRING, OemString),
|
||||
MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_OPTION_STRING, SystemOptionString),
|
||||
};
|
||||
|
||||
//
|
||||
// Number of Data Table entries.
|
||||
//
|
||||
UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SUBCLASS_DATA_TABLE);
|
||||
|
||||
/* eof - MiscSubclassDriverDataTable.c */
|
@@ -0,0 +1,518 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSubclassDriverEntryPoint.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
|
||||
extern UINT8 MiscSubclassStrings[];
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
WinNtIoProtocolNotifyFunction (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
EFI_STATUS
|
||||
LogRecordDataToDataHub (
|
||||
EFI_DATA_HUB_PROTOCOL *DataHub,
|
||||
UINT32 RecordType,
|
||||
UINT32 RecordLen,
|
||||
VOID *RecordData
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
Parameters:
|
||||
|
||||
DataHub
|
||||
%%TBD
|
||||
|
||||
RecordType
|
||||
%%TBD
|
||||
|
||||
RecordLen
|
||||
%%TBD
|
||||
|
||||
RecordData
|
||||
%%TBD
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_INVALID_PARAMETER
|
||||
|
||||
EFI_SUCCESS
|
||||
|
||||
Other Data Hub errors
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_MISC_SUBCLASS_DRIVER_DATA MiscSubclass;
|
||||
EFI_STATUS EfiStatus;
|
||||
|
||||
//
|
||||
// Do nothing if data parameters are not valid.
|
||||
//
|
||||
if (RecordLen == 0 || RecordData == NULL) {
|
||||
DEBUG (
|
||||
(EFI_D_ERROR,
|
||||
"RecordLen == %d RecordData == %xh\n",
|
||||
RecordLen,
|
||||
RecordData)
|
||||
);
|
||||
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Assemble Data Hub record.
|
||||
//
|
||||
MiscSubclass.Header.Version = EFI_MISC_SUBCLASS_VERSION;
|
||||
MiscSubclass.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
|
||||
MiscSubclass.Header.Instance = 1;
|
||||
MiscSubclass.Header.SubInstance = 1;
|
||||
MiscSubclass.Header.RecordType = RecordType;
|
||||
|
||||
CopyMem (
|
||||
&MiscSubclass.Record,
|
||||
RecordData,
|
||||
RecordLen
|
||||
);
|
||||
|
||||
//
|
||||
// Log Data Hub record.
|
||||
//
|
||||
EfiStatus = DataHub->LogData (
|
||||
DataHub,
|
||||
&gEfiMiscSubClassGuid,
|
||||
&gEfiMiscSubClassGuid,
|
||||
EFI_DATA_RECORD_CLASS_DATA,
|
||||
&MiscSubclass,
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen
|
||||
);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG (
|
||||
(EFI_D_ERROR,
|
||||
"LogData(%d bytes) == %r\n",
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen,
|
||||
EfiStatus)
|
||||
);
|
||||
}
|
||||
|
||||
return EfiStatus;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MiscSubclassDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
Standard EFI driver point. This driver parses the mMiscSubclassDataTable
|
||||
structure and reports any generated data to the DataHub.
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle
|
||||
Handle for the image of this driver
|
||||
|
||||
SystemTable
|
||||
Pointer to the EFI System Table
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
The data was successfully reported to the Data Hub.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_MISC_SUBCLASS_DRIVER_DATA RecordData;
|
||||
EFI_DATA_HUB_PROTOCOL *DataHub;
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_STATUS EfiStatus;
|
||||
UINTN Index;
|
||||
BOOLEAN LogRecordData;
|
||||
EFI_EVENT Event;
|
||||
VOID *Registration;
|
||||
|
||||
|
||||
//
|
||||
// Initialize constant portion of subclass header.
|
||||
//
|
||||
RecordData.Header.Version = EFI_MISC_SUBCLASS_VERSION;
|
||||
RecordData.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
|
||||
RecordData.Header.Instance = 1;
|
||||
RecordData.Header.SubInstance = 1;
|
||||
|
||||
//
|
||||
// Locate data hub protocol.
|
||||
//
|
||||
EfiStatus = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &DataHub);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG ((EFI_D_ERROR, "Could not locate DataHub protocol. %r\n", EfiStatus));
|
||||
return EfiStatus;
|
||||
} else if (DataHub == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "LocateProtocol(DataHub) returned NULL pointer!\n"));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
//
|
||||
// Locate hii protocol.
|
||||
//
|
||||
EfiStatus = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, &Hii);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG ((EFI_D_ERROR, "Could not locate Hii protocol. %r\n", EfiStatus));
|
||||
return EfiStatus;
|
||||
} else if (Hii == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "LocateProtocol(Hii) returned NULL pointer!\n"));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
//
|
||||
// Add our default strings to the HII database. They will be modified later.
|
||||
//
|
||||
PackageList = PreparePackages (1, &gEfiMiscSubClassGuid, MiscSubclassStrings);
|
||||
EfiStatus = Hii->NewPack (Hii, PackageList, &HiiHandle);
|
||||
gBS->FreePool (PackageList);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", EfiStatus));
|
||||
return EfiStatus;
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {
|
||||
//
|
||||
// Stupidity check! Do nothing if RecordLen is zero.
|
||||
// %%TBD - Should this be an error or a mechanism for ignoring
|
||||
// records in the Data Table?
|
||||
//
|
||||
if (mMiscSubclassDataTable[Index].RecordLen == 0) {
|
||||
DEBUG (
|
||||
(EFI_D_ERROR,
|
||||
"mMiscSubclassDataTable[%d].RecordLen == 0\n",
|
||||
Index)
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Initialize per-record portion of subclass header and
|
||||
// copy static data into data portion of subclass record.
|
||||
//
|
||||
RecordData.Header.RecordType = mMiscSubclassDataTable[Index].RecordType;
|
||||
|
||||
if (mMiscSubclassDataTable[Index].RecordData == NULL) {
|
||||
ZeroMem (
|
||||
&RecordData.Record,
|
||||
mMiscSubclassDataTable[Index].RecordLen
|
||||
);
|
||||
} else {
|
||||
CopyMem (
|
||||
&RecordData.Record,
|
||||
mMiscSubclassDataTable[Index].RecordData,
|
||||
mMiscSubclassDataTable[Index].RecordLen
|
||||
);
|
||||
}
|
||||
//
|
||||
// If the entry does not have a function pointer, just log the data.
|
||||
//
|
||||
if (mMiscSubclassDataTable[Index].Function == NULL) {
|
||||
//
|
||||
// Log RecordData to Data Hub.
|
||||
//
|
||||
EfiStatus = DataHub->LogData (
|
||||
DataHub,
|
||||
&gEfiMiscSubClassGuid,
|
||||
&gEfiMiscSubClassGuid,
|
||||
EFI_DATA_RECORD_CLASS_DATA,
|
||||
&RecordData,
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen
|
||||
);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG (
|
||||
(EFI_D_ERROR,
|
||||
"LogData(%d bytes) == %r\n",
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,
|
||||
EfiStatus)
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// The entry has a valid function pointer.
|
||||
// Keep calling the function and logging data until there
|
||||
// is no more data to log.
|
||||
//
|
||||
for (;;) {
|
||||
//
|
||||
//
|
||||
//
|
||||
EfiStatus = (*mMiscSubclassDataTable[Index].Function)
|
||||
(
|
||||
mMiscSubclassDataTable[Index].RecordType, &mMiscSubclassDataTable[Index].RecordLen, &RecordData.Record, &
|
||||
LogRecordData
|
||||
);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!LogRecordData) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
EfiStatus = DataHub->LogData (
|
||||
DataHub,
|
||||
&gEfiMiscSubClassGuid,
|
||||
&gEfiMiscSubClassGuid,
|
||||
EFI_DATA_RECORD_CLASS_DATA,
|
||||
&RecordData,
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen
|
||||
);
|
||||
|
||||
if (EFI_ERROR (EfiStatus)) {
|
||||
DEBUG (
|
||||
(EFI_D_ERROR,
|
||||
"LogData(%d bytes) == %r\n",
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,
|
||||
EfiStatus)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Install notify function to fetch memory data through WinNtIo protocol and store to data hub.
|
||||
//
|
||||
EfiStatus = gBS->CreateEvent (
|
||||
EFI_EVENT_NOTIFY_SIGNAL,
|
||||
EFI_TPL_CALLBACK,
|
||||
WinNtIoProtocolNotifyFunction,
|
||||
ImageHandle,
|
||||
&Event
|
||||
);
|
||||
ASSERT (!EFI_ERROR (EfiStatus));
|
||||
|
||||
EfiStatus = gBS->RegisterProtocolNotify (
|
||||
&gEfiWinNtIoProtocolGuid,
|
||||
Event,
|
||||
&Registration
|
||||
);
|
||||
ASSERT (!EFI_ERROR (EfiStatus));
|
||||
|
||||
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 == '"')) {
|
||||
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;
|
||||
}
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
WinNtIoProtocolNotifyFunction (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function will log memory size data to data hub.
|
||||
|
||||
Arguments:
|
||||
Event - Event whose notification function is being invoked.
|
||||
Context - Pointer to the notification function's context.
|
||||
|
||||
Returns:
|
||||
EFI_STATUS.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_MEMORY_SUBCLASS_DRIVER_DATA MemorySubClassData;
|
||||
EFI_DATA_RECORD_HEADER *Record;
|
||||
EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
|
||||
UINTN HandleCount;
|
||||
UINTN HandleIndex;
|
||||
UINT64 MonotonicCount;
|
||||
BOOLEAN RecordFound;
|
||||
EFI_HANDLE *HandleBuffer;
|
||||
EFI_WIN_NT_IO_PROTOCOL *WinNtIo;
|
||||
EFI_DATA_HUB_PROTOCOL *DataHub;
|
||||
UINT64 TotalMemorySize;
|
||||
|
||||
DataHub = NULL;
|
||||
MonotonicCount = 0;
|
||||
RecordFound = FALSE;
|
||||
|
||||
//
|
||||
// Retrieve the list of all handles from the handle database.
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
AllHandles,
|
||||
&gEfiWinNtIoProtocolGuid,
|
||||
NULL,
|
||||
&HandleCount,
|
||||
&HandleBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Locate DataHub protocol.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, &DataHub);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Search the Handle array to find the meory size information.
|
||||
//
|
||||
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
|
||||
Status = gBS->OpenProtocol (
|
||||
HandleBuffer[HandleIndex],
|
||||
&gEfiWinNtIoProtocolGuid,
|
||||
&WinNtIo,
|
||||
Context,
|
||||
NULL,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((WinNtIo->WinNtThunk->Signature == EFI_WIN_NT_THUNK_PROTOCOL_SIGNATURE) &&
|
||||
CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtMemoryGuid)
|
||||
) {
|
||||
//
|
||||
// Check if this record has been stored in data hub.
|
||||
//
|
||||
do {
|
||||
Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);
|
||||
if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
|
||||
DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
|
||||
if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&
|
||||
(DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)
|
||||
) {
|
||||
RecordFound = TRUE;
|
||||
}
|
||||
}
|
||||
} while (MonotonicCount != 0);
|
||||
|
||||
if (RecordFound) {
|
||||
RecordFound = FALSE;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Initialize data record.
|
||||
//
|
||||
MemorySubClassData.Header.Instance = 1;
|
||||
MemorySubClassData.Header.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
|
||||
MemorySubClassData.Header.RecordType = EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER;
|
||||
|
||||
TotalMemorySize = (UINT64) Atoi (WinNtIo->EnvString);
|
||||
|
||||
MemorySubClassData.Record.ArrayStartAddress.MemoryArrayStartAddress = 0;
|
||||
MemorySubClassData.Record.ArrayStartAddress.MemoryArrayEndAddress = LShiftU64 (TotalMemorySize, 20) - 1;
|
||||
MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.ProducerName = gEfiMemoryProducerGuid;
|
||||
MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.Instance = 1;
|
||||
MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
|
||||
MemorySubClassData.Record.ArrayStartAddress.MemoryArrayPartitionWidth = 0;
|
||||
|
||||
//
|
||||
// Store memory size data record to data hub.
|
||||
//
|
||||
Status = DataHub->LogData (
|
||||
DataHub,
|
||||
&gEfiMemorySubClassGuid,
|
||||
&gEfiMemoryProducerGuid,
|
||||
EFI_DATA_RECORD_CLASS_DATA,
|
||||
&MemorySubClassData,
|
||||
sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_START_ADDRESS_DATA)
|
||||
);
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
HandleBuffer[HandleIndex],
|
||||
&gEfiWinNtIoProtocolGuid,
|
||||
Context,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSystemLanguageStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
|
||||
0,
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscSystemLanguageStringData.c */
|
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSystemManufacturerData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) System Manufacturer data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)
|
||||
= {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER),
|
||||
// SystemManufactrurer
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_PRODUCT_NAME),
|
||||
// SystemProductName
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_VERSION),
|
||||
// SystemVersion
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_SERIAL_NUMBER),
|
||||
// SystemSerialNumber
|
||||
{
|
||||
0xbadfaced,
|
||||
0xdead,
|
||||
0xbeef,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13,
|
||||
0x13
|
||||
},
|
||||
// SystemUuid
|
||||
EfiSystemWakeupTypePowerSwitch // SystemWakeupType
|
||||
};
|
||||
|
||||
/* eof - MiscSystemManufacturerData.c */
|
@@ -0,0 +1,122 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSystemManufacturerFunction.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_FUNCTION (
|
||||
MiscSystemManufacturer
|
||||
)
|
||||
/*++
|
||||
Description:
|
||||
|
||||
This function makes boot time changes to the contents of the
|
||||
MiscSystemManufacturer (Type 13).
|
||||
|
||||
Parameters:
|
||||
|
||||
RecordType
|
||||
Type of record to be processed from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordType
|
||||
|
||||
RecordLen
|
||||
Size of static RecordData from the Data Table.
|
||||
mMiscSubclassDataTable[].RecordLen
|
||||
|
||||
RecordData
|
||||
Pointer to copy of RecordData from the Data Table. Changes made
|
||||
to this copy will be written to the Data Hub but will not alter
|
||||
the contents of the static Data Table.
|
||||
|
||||
LogRecordData
|
||||
Set *LogRecordData to TRUE to log RecordData to Data Hub.
|
||||
Set *LogRecordData to FALSE when there is no more data to log.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
All parameters were valid and *RecordData and *LogRecordData have
|
||||
been set.
|
||||
|
||||
EFI_UNSUPPORTED
|
||||
Unexpected RecordType value.
|
||||
|
||||
EFI_INVALID_PARAMETER
|
||||
One of the following parameter conditions was true:
|
||||
RecordLen was zero.
|
||||
RecordData was NULL.
|
||||
LogRecordData was NULL.
|
||||
--*/
|
||||
{
|
||||
STATIC BOOLEAN Done = FALSE;
|
||||
|
||||
//
|
||||
// First check for invalid parameters.
|
||||
//
|
||||
if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Then check for unsupported RecordType.
|
||||
//
|
||||
if (RecordType != EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Is this the first time through this function?
|
||||
//
|
||||
if (!Done) {
|
||||
//
|
||||
// Yes, this is the first time. Inspect/Change the contents of the
|
||||
// RecordData structure.
|
||||
//
|
||||
//
|
||||
// Set system GUID.
|
||||
//
|
||||
// ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemUuid = %%TBD
|
||||
//
|
||||
// Set power-on type.
|
||||
//
|
||||
// ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemWakeupType = %%TBD
|
||||
//
|
||||
// Set Done flag to TRUE for next pass through this function.
|
||||
// Set *LogRecordData to TRUE so data will get logged to Data Hub.
|
||||
//
|
||||
Done = TRUE;
|
||||
*LogRecordData = TRUE;
|
||||
} else {
|
||||
//
|
||||
// No, this is the second time. Reset the state of the Done flag
|
||||
// to FALSE and tell the data logger that there is no more data
|
||||
// to be logged for this record type. If any memory allocations
|
||||
// were made by earlier passes, they must be released now.
|
||||
//
|
||||
Done = FALSE;
|
||||
*LogRecordData = FALSE;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/* eof - MiscSystemManufacturerFunction.c */
|
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSystemOptionStringData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_OPTION_STRING)
|
||||
};
|
||||
|
||||
/* eof - MiscSystemOptionStringData.c */
|
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MiscSystemSlotDesignationData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This driver parses the mMiscSubclassDataTable structure and reports
|
||||
any generated data to the DataHub.
|
||||
|
||||
--*/
|
||||
|
||||
#include "MiscSubclassDriver.h"
|
||||
|
||||
//
|
||||
// Static (possibly build generated) Bios Vendor data.
|
||||
//
|
||||
MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {
|
||||
STRING_TOKEN(STR_MISC_SYSTEM_SLOT_DESIGNATION), // SlotDesignation
|
||||
EfiSlotTypeOther, // SlotType
|
||||
EfiSlotDataBusWidthOther, // SlotDataBusWidth
|
||||
EfiSlotUsageOther, // SlotUsage
|
||||
EfiSlotLengthOther, // SlotLength
|
||||
0, // SlotId
|
||||
{ // SlotCharacteristics
|
||||
0, // CharacteristicsUnknown :1;
|
||||
0, // Provides50Volts :1;
|
||||
0, // Provides33Volts :1;
|
||||
0, // SharedSlot :1;
|
||||
0, // PcCard16Supported :1;
|
||||
0, // CardBusSupported :1;
|
||||
0, // ZoomVideoSupported :1;
|
||||
0, // ModemRingResumeSupported:1;
|
||||
0, // PmeSignalSupported :1;
|
||||
0, // HotPlugDevicesSupported :1;
|
||||
0, // SmbusSignalSupported :1;
|
||||
0 // Reserved :21;
|
||||
},
|
||||
0 // SlotDevicePath
|
||||
};
|
||||
|
||||
/* eof - MiscSystemSlotsData.c */
|
47
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/build.xml
Normal file
47
EdkNt32Pkg/Dxe/Nt32Platform/MiscSubclass/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- 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.-->
|
||||
<project basedir="." default="MiscSubclass"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Dxe\Nt32Platform\MiscSubclass"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="MiscSubclass">
|
||||
<GenBuild baseName="MiscSubclass" mbdFilename="${MODULE_DIR}\MiscSubclassDriver.mbd" msaFilename="${MODULE_DIR}\MiscSubclassDriver.msa"/>
|
||||
</target>
|
||||
<target depends="MiscSubclass_clean" name="clean"/>
|
||||
<target depends="MiscSubclass_cleanall" name="cleanall"/>
|
||||
<target name="MiscSubclass_clean">
|
||||
<OutputDirSetup baseName="MiscSubclass" mbdFilename="${MODULE_DIR}\MiscSubclassDriver.mbd" msaFilename="${MODULE_DIR}\MiscSubclassDriver.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\MiscSubclass_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\MiscSubclass_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="MiscSubclass_cleanall">
|
||||
<OutputDirSetup baseName="MiscSubclass" mbdFilename="${MODULE_DIR}\MiscSubclassDriver.mbd" msaFilename="${MODULE_DIR}\MiscSubclassDriver.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\MiscSubclass_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\MiscSubclass_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**MiscSubclass*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
557
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.c
Normal file
557
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.c
Normal file
@@ -0,0 +1,557 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
PcdEmulator.c
|
||||
|
||||
Abstract:
|
||||
Platform Configuration Database (PCD) Protocol
|
||||
|
||||
--*/
|
||||
|
||||
#include <PcdEmulator.h>
|
||||
|
||||
UINTN mSkuId = 0;
|
||||
|
||||
STATIC UINTN
|
||||
GetPcdDataEntryCount (
|
||||
VOID
|
||||
) {
|
||||
return gEmulatedPcdDatabaseEx->Count;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSetSku (
|
||||
IN UINTN SkuId
|
||||
)
|
||||
{
|
||||
mSkuId = SkuId;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
UINT8
|
||||
EFIAPI
|
||||
PcdEmulatorGet8 (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
ASSERT (Pcd->DatumSize == 1);
|
||||
|
||||
return (UINT8)Pcd->Datum;
|
||||
}
|
||||
|
||||
UINT16
|
||||
EFIAPI
|
||||
PcdEmulatorGet16 (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
ASSERT (Pcd->DatumSize == 2);
|
||||
|
||||
return (UINT16)Pcd->Datum;
|
||||
}
|
||||
|
||||
UINT32
|
||||
EFIAPI
|
||||
PcdEmulatorGet32 (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
ASSERT (Pcd->DatumSize == 4);
|
||||
|
||||
return (UINT32)Pcd->Datum;
|
||||
}
|
||||
|
||||
UINT64
|
||||
EFIAPI
|
||||
PcdEmulatorGet64 (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
ASSERT (Pcd->DatumSize == sizeof (UINT64));
|
||||
|
||||
return (UINT64)Pcd->Datum;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
PcdEmulatorGetPtr (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
|
||||
return (VOID *)(UINTN)Pcd->ExtendedData;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PcdEmulatorGetBoolean (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
ASSERT (Pcd->DatumSize == 1);
|
||||
|
||||
return (BOOLEAN)Pcd->Datum;
|
||||
}
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PcdEmulatorGetSize (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
return Pcd->DatumSize;
|
||||
}
|
||||
|
||||
UINT8
|
||||
EFIAPI
|
||||
PcdEmulatorGet8Ex (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT16
|
||||
EFIAPI
|
||||
PcdEmulatorGet16Ex (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32
|
||||
EFIAPI
|
||||
PcdEmulatorGet32Ex (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT64
|
||||
EFIAPI
|
||||
PcdEmulatorGet64Ex (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
PcdEmulatorGetPtrEx (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PcdEmulatorGetBooleanEx (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
ASSERT (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PcdEmulatorGetSizeEx (
|
||||
IN CONST EFI_GUID *PcdDataBaseName,
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
return Pcd->DatumSize;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet8 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
|
||||
ASSERT (Pcd->DatumSize == sizeof (UINT8));
|
||||
|
||||
Pcd->Datum = Value;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet16 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet32 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
|
||||
ASSERT (Pcd->DatumSize == sizeof (UINT32));
|
||||
|
||||
Pcd->Datum = Value;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet64 (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN CONST VOID *Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSetBoolean (
|
||||
IN UINTN TokenNumber,
|
||||
IN BOOLEAN Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet8Ex (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT8 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet16Ex (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT16 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet32Ex (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT32 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSet64Ex (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINT64 Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSetPtrEx (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN CONST VOID *Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorSetBooleanEx (
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN BOOLEAN Value
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorCallBackOnSet (
|
||||
IN UINTN TokenNumber,
|
||||
IN CONST EFI_GUID *Guid, OPTIONAL
|
||||
IN PCD_PROTOCOL_CALLBACK CallBackFunction
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
|
||||
if (Pcd->CallBackListSize == Pcd->CallBackEntries) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Pcd->CallBackList[Pcd->CallBackEntries++] = CallBackFunction;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorUnregisterCallBackOnSet (
|
||||
IN UINTN TokenNumber,
|
||||
IN CONST EFI_GUID *Guid, OPTIONAL
|
||||
IN PCD_PROTOCOL_CALLBACK CallBackfunction
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
UINT32 Index;
|
||||
|
||||
Pcd = GetPcdEntry (TokenNumber);
|
||||
ASSERT (Pcd != NULL);
|
||||
|
||||
for (Index = 0; Index < Pcd->CallBackListSize; Index++) {
|
||||
if (Pcd->CallBackList[Index] == CallBackfunction) {
|
||||
Pcd->CallBackList[Index] = NULL;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorGetNextToken (
|
||||
IN CONST EFI_GUID *Guid, OPTIONAL
|
||||
IN UINTN *Token
|
||||
)
|
||||
{
|
||||
EMULATED_PCD_ENTRY_EX *Pcd;
|
||||
EMULATED_PCD_ENTRY_EX *LastPcdEntry;
|
||||
|
||||
if (*Token == PCD_INVALID_TOKEN) {
|
||||
//
|
||||
// BugBug: Due to variable size array, ensure we convert this to a reasonable database
|
||||
// that can accomodate array references for simplicity's sake
|
||||
*Token = gEmulatedPcdEntryEx[0].Token;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Pcd = GetPcdEntry (*Token);
|
||||
if (Pcd == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
LastPcdEntry = gEmulatedPcdEntryEx + GetPcdDataEntryCount ();
|
||||
if (++Pcd >= LastPcdEntry) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*Token = Pcd->Token;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
PCD_PROTOCOL mPcdProtocolInstance = {
|
||||
PcdEmulatorSetSku,
|
||||
|
||||
PcdEmulatorGet8,
|
||||
PcdEmulatorGet16,
|
||||
PcdEmulatorGet32,
|
||||
PcdEmulatorGet64,
|
||||
PcdEmulatorGetPtr,
|
||||
PcdEmulatorGetBoolean,
|
||||
PcdEmulatorGetSize,
|
||||
|
||||
PcdEmulatorGet8Ex,
|
||||
PcdEmulatorGet16Ex,
|
||||
PcdEmulatorGet32Ex,
|
||||
PcdEmulatorGet64Ex,
|
||||
PcdEmulatorGetPtrEx,
|
||||
PcdEmulatorGetBooleanEx,
|
||||
PcdEmulatorGetSizeEx,
|
||||
|
||||
PcdEmulatorSet8,
|
||||
PcdEmulatorSet16,
|
||||
PcdEmulatorSet32,
|
||||
PcdEmulatorSet64,
|
||||
PcdEmulatorSetPtr,
|
||||
PcdEmulatorSetBoolean,
|
||||
|
||||
PcdEmulatorSet8Ex,
|
||||
PcdEmulatorSet16Ex,
|
||||
PcdEmulatorSet32Ex,
|
||||
PcdEmulatorSet64Ex,
|
||||
PcdEmulatorSetPtrEx,
|
||||
PcdEmulatorSetBooleanEx,
|
||||
|
||||
PcdEmulatorCallBackOnSet,
|
||||
PcdEmulatorUnregisterCallBackOnSet,
|
||||
PcdEmulatorGetNextToken
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PcdEmulatorEntry (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gPcdHobGuid);
|
||||
gEmulatedPcdDatabaseEx = (EMULATED_PCD_DATABASE_EX *) GET_GUID_HOB_DATA(GuidHob);
|
||||
ASSERT (gEmulatedPcdDatabaseEx != NULL);
|
||||
gEmulatedPcdEntryEx = gEmulatedPcdDatabaseEx->Entry;
|
||||
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ImageHandle,
|
||||
&gPcdProtocolGuid, &mPcdProtocolInstance,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EMULATED_PCD_ENTRY_EX *
|
||||
GetPcdEntry (
|
||||
IN UINTN TokenNumber
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Count;
|
||||
|
||||
Count = GetPcdDataEntryCount ();
|
||||
for (Index = 0; Index < Count; Index++) {
|
||||
if (gEmulatedPcdEntryEx[Index].Token == TokenNumber) {
|
||||
return &gEmulatedPcdEntryEx[Index];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
27
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.dxs
Normal file
27
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.dxs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PcdEmulator.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file.
|
||||
|
||||
--*/
|
||||
|
||||
#include <AutoGen.h>
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
TRUE
|
||||
DEPENDENCY_END
|
43
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.h
Normal file
43
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
PcdEmulator.h
|
||||
|
||||
Abstract:
|
||||
Platform Configuration Database (PCD)
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef __PCD_EMULATOR_H__
|
||||
#define __PCD_EMULATOR_H__
|
||||
|
||||
|
||||
|
||||
//
|
||||
// BugBug: Not very sure, where to put this "extern"
|
||||
//
|
||||
extern GUID gPcdHobGuid;
|
||||
|
||||
//
|
||||
// BugBug: Hack max number of callbacks per token
|
||||
//
|
||||
#define MAX_PCD_CALLBACK 0x10
|
||||
|
||||
EMULATED_PCD_ENTRY_EX *gEmulatedPcdEntryEx;
|
||||
EMULATED_PCD_DATABASE_EX *gEmulatedPcdDatabaseEx;
|
||||
|
||||
EMULATED_PCD_ENTRY_EX *
|
||||
GetPcdEntry (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
#endif
|
46
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.mbd
Normal file
46
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.mbd
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>PcdEmulator</BaseName>
|
||||
<Guid>80CF7257-87AB-47f9-A3FE-D50B76D89541</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Modified>2006-03-19 15:17</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>DxeHobLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>HiiLib</Library>
|
||||
<Library>DxeWinNtLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
75
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.msa
Normal file
75
EdkNt32Pkg/Dxe/PcdEmulator/PcdEmulator.msa
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>PcdEmulator</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>80CF7257-87AB-47f9-A3FE-D50B76D89541</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DxeIpl module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>0</Specification>
|
||||
<Created>2006-03-14 17:04</Created>
|
||||
<Updated>2006-03-19 15:17</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HiiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PcdLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">WinNtLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PcdEmulator.c</Filename>
|
||||
<Filename>PcdEmulator.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
<PackageName>EdkNt32Pkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">Pcd</Protocol>
|
||||
</Protocols>
|
||||
<Hobs>
|
||||
<Hob Usage="ALWAYS_CONSUMED" HobType="GUID_EXTENSION">
|
||||
<Name>PcdDataBase</Name>
|
||||
<C_Name>gPcdHobGuid</C_Name>
|
||||
<Guid>0x582e7ca1, 0x68cd, 0x4d44, 0xb4, 0x3b, 0xf2, 0x98, 0xed, 0x58, 0x7b, 0xa6</Guid>
|
||||
</Hob>
|
||||
</Hobs>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>PcdHob</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PcdEmulatorEntry</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
47
EdkNt32Pkg/Dxe/PcdEmulator/build.xml
Normal file
47
EdkNt32Pkg/Dxe/PcdEmulator/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- 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.-->
|
||||
<project basedir="." default="PcdEmulator"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Dxe\PcdEmulator"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="PcdEmulator">
|
||||
<GenBuild baseName="PcdEmulator" mbdFilename="${MODULE_DIR}\PcdEmulator.mbd" msaFilename="${MODULE_DIR}\PcdEmulator.msa"/>
|
||||
</target>
|
||||
<target depends="PcdEmulator_clean" name="clean"/>
|
||||
<target depends="PcdEmulator_cleanall" name="cleanall"/>
|
||||
<target name="PcdEmulator_clean">
|
||||
<OutputDirSetup baseName="PcdEmulator" mbdFilename="${MODULE_DIR}\PcdEmulator.mbd" msaFilename="${MODULE_DIR}\PcdEmulator.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PcdEmulator_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PcdEmulator_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="PcdEmulator_cleanall">
|
||||
<OutputDirSetup baseName="PcdEmulator" mbdFilename="${MODULE_DIR}\PcdEmulator.mbd" msaFilename="${MODULE_DIR}\PcdEmulator.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\PcdEmulator_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\PcdEmulator_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**PcdEmulator*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
517
EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c
Normal file
517
EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.c
Normal file
@@ -0,0 +1,517 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BdsPlatform.c
|
||||
|
||||
Abstract:
|
||||
|
||||
This file include all platform action which can be customized
|
||||
by IBV/OEM.
|
||||
|
||||
--*/
|
||||
|
||||
#include "Generic/Bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
#include "Generic/String.h"
|
||||
#include "Generic/Language.h"
|
||||
#include "Generic/FrontPage.h"
|
||||
|
||||
CHAR16 mFirmwareVendor[] = L"TianoCore.org";
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
VOID
|
||||
PlatformBdsInit (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Platform Bds init. Incude the platform firmware vendor, revision
|
||||
and so crc check.
|
||||
|
||||
Arguments:
|
||||
|
||||
PrivateData - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// set firmwarevendor, here can be IBV/OEM customize
|
||||
//
|
||||
gST->FirmwareVendor = AllocateRuntimeCopyPool (
|
||||
sizeof (mFirmwareVendor),
|
||||
&mFirmwareVendor
|
||||
);
|
||||
ASSERT (gST->FirmwareVendor != NULL);
|
||||
|
||||
gST->FirmwareRevision = EFI_FIRMWARE_REVISION;
|
||||
|
||||
//
|
||||
// Fixup Tasble CRC after we updated Firmware Vendor and Revision
|
||||
//
|
||||
gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);
|
||||
|
||||
//
|
||||
// Initialize the platform specific string and language
|
||||
//
|
||||
InitializeStringSupport ();
|
||||
InitializeLanguage (TRUE);
|
||||
InitializeFrontPage (FALSE);
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsConnectConsole (
|
||||
IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Connect the predefined platform default console device. Always try to find
|
||||
and enable the vga device if have.
|
||||
|
||||
Arguments:
|
||||
|
||||
PlatformConsole - Predfined platform default console device array.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Success connect at least one ConIn and ConOut
|
||||
device, there must have one ConOut device is
|
||||
active vga device.
|
||||
|
||||
EFI_STATUS - Return the status of
|
||||
BdsLibConnectAllDefaultConsoles ()
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
|
||||
Index = 0;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Have chance to connect the platform default console,
|
||||
// the platform default console is the minimue device group
|
||||
// the platform should support
|
||||
//
|
||||
while (PlatformConsole[Index].DevicePath != NULL) {
|
||||
//
|
||||
// Update the console variable with the connect type
|
||||
//
|
||||
if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
|
||||
BdsLibUpdateConsoleVariable (L"ConIn", PlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
|
||||
if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
|
||||
BdsLibUpdateConsoleVariable (L"ConOut", PlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
|
||||
if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
|
||||
BdsLibUpdateConsoleVariable (L"ErrOut", PlatformConsole[Index].DevicePath, NULL);
|
||||
}
|
||||
|
||||
Index++;
|
||||
}
|
||||
//
|
||||
// Connect the all the default console with current cosole variable
|
||||
//
|
||||
Status = BdsLibConnectAllDefaultConsoles ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsConnectSequence (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Connect with predeined platform connect sequence,
|
||||
the OEM/IBV can customize with their own connect sequence.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
Index = 0;
|
||||
|
||||
//
|
||||
// Here we can get the customized platform connect sequence
|
||||
// Notes: we can connect with new variable which record the
|
||||
// last time boots connect device path sequence
|
||||
//
|
||||
while (gPlatformConnectSequence[Index] != NULL) {
|
||||
//
|
||||
// Build the platform boot option
|
||||
//
|
||||
BdsLibConnectDevicePath (gPlatformConnectSequence[Index]);
|
||||
Index++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsGetDriverOption (
|
||||
IN OUT LIST_ENTRY *BdsDriverLists
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Load the predefined driver option, OEM/IBV can customize this
|
||||
to load their own drivers
|
||||
|
||||
Arguments:
|
||||
|
||||
BdsDriverLists - The header of the driver option link list.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
Index = 0;
|
||||
|
||||
//
|
||||
// Here we can get the customized platform driver option
|
||||
//
|
||||
while (gPlatformDriverOption[Index] != NULL) {
|
||||
//
|
||||
// Build the platform boot option
|
||||
//
|
||||
BdsLibRegisterNewOption (BdsDriverLists, gPlatformDriverOption[Index], NULL, L"DriverOrder");
|
||||
Index++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsDiagnostics (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,
|
||||
IN BOOLEAN QuietBoot
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the platform diagnostic, such like test memory. OEM/IBV also
|
||||
can customize this fuction to support specific platform diagnostic.
|
||||
|
||||
Arguments:
|
||||
|
||||
MemoryTestLevel - The memory test intensive level
|
||||
|
||||
QuietBoot - Indicate if need to enable the quiet boot
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Here we can decide if we need to show
|
||||
// the diagnostics screen
|
||||
// Notes: this quiet boot code should be remove
|
||||
// from the graphic lib
|
||||
//
|
||||
if (QuietBoot) {
|
||||
EnableQuietBoot (&gEfiUgaSplashProtocolGuid);
|
||||
//
|
||||
// Perform system diagnostic
|
||||
//
|
||||
Status = BdsMemoryTest (MemoryTestLevel);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DisableQuietBoot ();
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Perform system diagnostic
|
||||
//
|
||||
Status = BdsMemoryTest (MemoryTestLevel);
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsPolicyBehavior (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData,
|
||||
IN OUT LIST_ENTRY *DriverOptionList,
|
||||
IN OUT LIST_ENTRY *BootOptionList
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
The function will excute with as the platform policy, current policy
|
||||
is driven by boot mode. IBV/OEM can customize this code for their specific
|
||||
policy action.
|
||||
|
||||
Arguments:
|
||||
|
||||
PrivateData - The EFI_BDS_ARCH_PROTOCOL_INSTANCE instance
|
||||
|
||||
DriverOptionList - The header of the driver option link list
|
||||
|
||||
BootOptionList - The header of the boot option link list
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 Timeout;
|
||||
|
||||
//
|
||||
// Init the time out value
|
||||
//
|
||||
Timeout = BdsLibGetTimeout ();
|
||||
|
||||
//
|
||||
// Load the driver option as the driver option list
|
||||
//
|
||||
PlatformBdsGetDriverOption (DriverOptionList);
|
||||
|
||||
//
|
||||
// Get current Boot Mode
|
||||
//
|
||||
Status = BdsLibGetBootMode (&PrivateData->BootMode);
|
||||
|
||||
//
|
||||
// Go the different platform policy with different boot mode
|
||||
// Notes: this part code can be change with the table policy
|
||||
//
|
||||
switch (PrivateData->BootMode) {
|
||||
|
||||
case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
|
||||
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
||||
//
|
||||
// In no-configuration boot mode, we can connect the
|
||||
// console directly.
|
||||
//
|
||||
BdsLibConnectAllDefaultConsoles ();
|
||||
PlatformBdsDiagnostics (IGNORE, TRUE);
|
||||
|
||||
//
|
||||
// Perform some platform specific connect sequence
|
||||
//
|
||||
PlatformBdsConnectSequence ();
|
||||
|
||||
//
|
||||
// Notes: current time out = 0 can not enter the
|
||||
// front page
|
||||
//
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
|
||||
//
|
||||
// Check the boot option with the boot option list
|
||||
//
|
||||
BdsLibBuildOptionFromVar (BootOptionList, L"BootOrder");
|
||||
break;
|
||||
|
||||
case BOOT_ON_FLASH_UPDATE:
|
||||
//
|
||||
// Boot with the specific configuration
|
||||
//
|
||||
PlatformBdsConnectConsole (gPlatformConsole);
|
||||
PlatformBdsDiagnostics (EXTENSIVE, FALSE);
|
||||
BdsLibConnectAll ();
|
||||
ProcessCapsules (BOOT_ON_FLASH_UPDATE);
|
||||
break;
|
||||
|
||||
case BOOT_IN_RECOVERY_MODE:
|
||||
//
|
||||
// In recovery mode, just connect platform console
|
||||
// and show up the front page
|
||||
//
|
||||
PlatformBdsConnectConsole (gPlatformConsole);
|
||||
PlatformBdsDiagnostics (EXTENSIVE, FALSE);
|
||||
|
||||
//
|
||||
// In recovery boot mode, we still enter to the
|
||||
// frong page now
|
||||
//
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
break;
|
||||
|
||||
case BOOT_WITH_FULL_CONFIGURATION:
|
||||
case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
|
||||
case BOOT_WITH_DEFAULT_SETTINGS:
|
||||
default:
|
||||
//
|
||||
// Connect platform console
|
||||
//
|
||||
Status = PlatformBdsConnectConsole (gPlatformConsole);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Here OEM/IBV can customize with defined action
|
||||
//
|
||||
PlatformBdsNoConsoleAction ();
|
||||
}
|
||||
|
||||
PlatformBdsDiagnostics (IGNORE, TRUE);
|
||||
|
||||
//
|
||||
// Perform some platform specific connect sequence
|
||||
//
|
||||
PlatformBdsConnectSequence ();
|
||||
|
||||
//
|
||||
// Give one chance to enter the setup if we
|
||||
// have the time out
|
||||
//
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
|
||||
//
|
||||
// Here we have enough time to do the enumeration of boot device
|
||||
//
|
||||
BdsLibEnumerateAllBootOption (BootOptionList);
|
||||
break;
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsBootSuccess (
|
||||
IN BDS_COMMON_OPTION *Option
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Hook point after a boot attempt succeeds. We don't expect a boot option to
|
||||
return, so the EFI 1.0 specification defines that you will default to an
|
||||
interactive mode and stop processing the BootOrder list in this case. This
|
||||
is alos a platform implementation and can be customized by IBV/OEM.
|
||||
|
||||
Arguments:
|
||||
|
||||
Option - Pointer to Boot Option that succeeded to boot.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *TmpStr;
|
||||
|
||||
//
|
||||
// If Boot returned with EFI_SUCCESS and there is not in the boot device
|
||||
// select loop then we need to pop up a UI and wait for user input.
|
||||
//
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
|
||||
if (TmpStr != NULL) {
|
||||
BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsBootFail (
|
||||
IN BDS_COMMON_OPTION *Option,
|
||||
IN EFI_STATUS Status,
|
||||
IN CHAR16 *ExitData,
|
||||
IN UINTN ExitDataSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Hook point after a boot attempt fails.
|
||||
|
||||
Arguments:
|
||||
|
||||
Option - Pointer to Boot Option that failed to boot.
|
||||
|
||||
Status - Status returned from failed boot.
|
||||
|
||||
ExitData - Exit data returned from failed boot.
|
||||
|
||||
ExitDataSize - Exit data size returned from failed boot.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *TmpStr;
|
||||
|
||||
//
|
||||
// If Boot returned with failed status then we need to pop up a UI and wait
|
||||
// for user input.
|
||||
//
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
|
||||
if (TmpStr != NULL) {
|
||||
BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsNoConsoleAction (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function is remained for IBV/OEM to do some platform action,
|
||||
if there no console device can be connected.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Direct return success now.
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
140
EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
Normal file
140
EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BdsPlatform.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file for BDS Platform specific code
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _BDS_PLATFORM_H
|
||||
#define _BDS_PLATFORM_H
|
||||
|
||||
#include "IndustryStandard/Pci22.h"
|
||||
|
||||
extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
|
||||
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
|
||||
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[];
|
||||
|
||||
#define gEndEntire \
|
||||
{ \
|
||||
END_DEVICE_PATH_TYPE,\
|
||||
END_ENTIRE_DEVICE_PATH_SUBTYPE,\
|
||||
END_DEVICE_PATH_LENGTH,\
|
||||
0\
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH VendorDevicePath;
|
||||
UINT32 Instance;
|
||||
} WIN_NT_VENDOR_DEVICE_PATH_NODE;
|
||||
|
||||
//
|
||||
// Below is the platform console device path
|
||||
//
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH NtBus;
|
||||
WIN_NT_VENDOR_DEVICE_PATH_NODE SerialDevice;
|
||||
UART_DEVICE_PATH Uart;
|
||||
VENDOR_DEVICE_PATH TerminalType;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} NT_ISA_SERIAL_DEVICE_PATH;
|
||||
|
||||
typedef struct {
|
||||
VENDOR_DEVICE_PATH NtBus;
|
||||
WIN_NT_VENDOR_DEVICE_PATH_NODE NtUgaDevice;
|
||||
EFI_DEVICE_PATH_PROTOCOL End;
|
||||
} NT_PLATFORM_UGA_DEVICE_PATH;
|
||||
|
||||
//
|
||||
// Platform BDS Functions
|
||||
//
|
||||
VOID
|
||||
PlatformBdsInit (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsPolicyBehavior (
|
||||
IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData,
|
||||
IN LIST_ENTRY *DriverOptionList,
|
||||
IN LIST_ENTRY *BootOptionList
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsGetDriverOption (
|
||||
IN LIST_ENTRY *BdsDriverLists
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BdsMemoryTest (
|
||||
EXTENDMEM_COVERAGE_LEVEL Level
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsShowProgress (
|
||||
EFI_UGA_PIXEL TitleForeground,
|
||||
EFI_UGA_PIXEL TitleBackground,
|
||||
CHAR16 *Title,
|
||||
EFI_UGA_PIXEL ProgressColor,
|
||||
UINTN Progress,
|
||||
UINTN PreviousValue
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsConnectSequence (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsBootFail (
|
||||
IN BDS_COMMON_OPTION *Option,
|
||||
IN EFI_STATUS Status,
|
||||
IN CHAR16 *ExitData,
|
||||
IN UINTN ExitDataSize
|
||||
)
|
||||
;
|
||||
|
||||
VOID
|
||||
PlatformBdsBootSuccess (
|
||||
IN BDS_COMMON_OPTION *Option
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessCapsules (
|
||||
EFI_BOOT_MODE BootMode
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsConnectConsole (
|
||||
IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PlatformBdsNoConsoleAction (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
#endif // _BDS_PLATFORM_H
|
27
EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.dxs
Normal file
27
EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.dxs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
Bds.dxs
|
||||
|
||||
Abstract:
|
||||
|
||||
Dependency expression source file. This driver produces an arch protocol, so
|
||||
must dipatch early.
|
||||
|
||||
--*/
|
||||
#include <AutoGen.h>
|
||||
#include <DxeDepex.h>
|
||||
|
||||
DEPENDENCY_START
|
||||
EFI_HII_PROTOCOL_GUID
|
||||
DEPENDENCY_END
|
83
EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.h
Normal file
83
EdkNt32Pkg/Dxe/PlatformBds/Generic/Bds.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
Bds.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Head file for BDS Architectural Protocol implementation
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _BDS_H
|
||||
#define _BDS_H
|
||||
|
||||
//
|
||||
// Bds AP Context data
|
||||
//
|
||||
#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 's', 'A')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
EFI_BDS_ARCH_PROTOCOL Bds;
|
||||
|
||||
//
|
||||
// Save the current boot mode
|
||||
//
|
||||
EFI_BOOT_MODE BootMode;
|
||||
|
||||
//
|
||||
// Set true if boot with default settings
|
||||
//
|
||||
BOOLEAN DefaultBoot;
|
||||
|
||||
//
|
||||
// The system default timeout for choose the boot option
|
||||
//
|
||||
UINT16 TimeoutDefault;
|
||||
|
||||
//
|
||||
// Memory Test Level
|
||||
//
|
||||
EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel;
|
||||
|
||||
} EFI_BDS_ARCH_PROTOCOL_INSTANCE;
|
||||
|
||||
#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS(_this) \
|
||||
CR (_this, \
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE, \
|
||||
Bds, \
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE \
|
||||
)
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsEntry (
|
||||
IN EFI_BDS_ARCH_PROTOCOL *This
|
||||
);
|
||||
|
||||
#endif
|
356
EdkNt32Pkg/Dxe/PlatformBds/Generic/BdsEntry.c
Normal file
356
EdkNt32Pkg/Dxe/PlatformBds/Generic/BdsEntry.c
Normal file
@@ -0,0 +1,356 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BdsEntry.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The entry of the bds
|
||||
|
||||
--*/
|
||||
|
||||
#include "Bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
#include "FrontPage.h"
|
||||
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE gBdsInstanceTemplate = {
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,
|
||||
NULL,
|
||||
BdsEntry,
|
||||
0xFFFF,
|
||||
TRUE,
|
||||
EXTENSIVE
|
||||
};
|
||||
|
||||
UINT16 *mBootNext = NULL;
|
||||
|
||||
EFI_HANDLE mBdsImageHandle;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsInitialize (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Install Boot Device Selection Protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - BDS has finished initializing.
|
||||
Rerun the
|
||||
dispatcher and recall BDS.Entry
|
||||
|
||||
Other - Return value from EfiLibAllocatePool()
|
||||
or gBS->InstallProtocolInterface
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mBdsImageHandle = ImageHandle;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&gBdsInstanceTemplate.Handle,
|
||||
&gEfiBdsArchProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&gBdsInstanceTemplate.Bds
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
BdsBootDeviceSelect (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
In the loop of attempt to boot for the boot order
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
BDS_COMMON_OPTION *BootOption;
|
||||
UINTN ExitDataSize;
|
||||
CHAR16 *ExitData;
|
||||
UINT16 Timeout;
|
||||
LIST_ENTRY BootLists;
|
||||
CHAR16 Buffer[20];
|
||||
BOOLEAN BootNextExist;
|
||||
LIST_ENTRY *LinkBootNext;
|
||||
|
||||
//
|
||||
// Got the latest boot option
|
||||
//
|
||||
BootNextExist = FALSE;
|
||||
LinkBootNext = NULL;
|
||||
InitializeListHead (&BootLists);
|
||||
|
||||
//
|
||||
// First check the boot next option
|
||||
//
|
||||
ZeroMem (Buffer, sizeof (Buffer));
|
||||
|
||||
if (mBootNext != NULL) {
|
||||
//
|
||||
// Indicate we have the boot next variable, so this time
|
||||
// boot will always have this boot option
|
||||
//
|
||||
BootNextExist = TRUE;
|
||||
|
||||
//
|
||||
// Clear the this variable so it's only exist in this time boot
|
||||
//
|
||||
gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
mBootNext
|
||||
);
|
||||
|
||||
//
|
||||
// Add the boot next boot option
|
||||
//
|
||||
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
|
||||
BootOption = BdsLibVariableToOption (&BootLists, Buffer);
|
||||
}
|
||||
//
|
||||
// Parse the boot order to get boot option
|
||||
//
|
||||
BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
|
||||
Link = BootLists.ForwardLink;
|
||||
|
||||
//
|
||||
// Parameter check, make sure the loop will be valid
|
||||
//
|
||||
if (Link == NULL) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Here we make the boot in a loop, every boot success will
|
||||
// return to the front page
|
||||
//
|
||||
for (;;) {
|
||||
//
|
||||
// Check the boot option list first
|
||||
//
|
||||
if (Link == &BootLists) {
|
||||
//
|
||||
// There are two ways to enter here:
|
||||
// 1. There is no active boot option, give user chance to
|
||||
// add new boot option
|
||||
// 2. All the active boot option processed, and there is no
|
||||
// one is success to boot, then we back here to allow user
|
||||
// add new active boot option
|
||||
//
|
||||
Timeout = 0xffff;
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
InitializeListHead (&BootLists);
|
||||
BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
|
||||
Link = BootLists.ForwardLink;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Get the boot option from the link list
|
||||
//
|
||||
BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
||||
|
||||
//
|
||||
// According to EFI Specification, if a load option is not marked
|
||||
// as LOAD_OPTION_ACTIVE, the boot manager will not automatically
|
||||
// load the option.
|
||||
//
|
||||
if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {
|
||||
//
|
||||
// skip the header of the link list, becuase it has no boot option
|
||||
//
|
||||
Link = Link->ForwardLink;
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Make sure the boot option device path connected,
|
||||
// but ignore the BBS device path
|
||||
//
|
||||
if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {
|
||||
//
|
||||
// Notes: the internal shell can not been connected with device path
|
||||
// so we do not check the status here
|
||||
//
|
||||
BdsLibConnectDevicePath (BootOption->DevicePath);
|
||||
}
|
||||
//
|
||||
// All the driver options should have been processed since
|
||||
// now boot will be performed.
|
||||
//
|
||||
PERF_END (0, BDS_TOK, NULL, 0);
|
||||
Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Call platform action to indicate the boot fail
|
||||
//
|
||||
PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
|
||||
|
||||
//
|
||||
// Check the next boot option
|
||||
//
|
||||
Link = Link->ForwardLink;
|
||||
|
||||
} else {
|
||||
//
|
||||
// Call platform action to indicate the boot success
|
||||
//
|
||||
PlatformBdsBootSuccess (BootOption);
|
||||
|
||||
//
|
||||
// Boot success, then stop process the boot order, and
|
||||
// present the boot manager menu, front page
|
||||
//
|
||||
Timeout = 0xffff;
|
||||
PlatformBdsEnterFrontPage (Timeout, FALSE);
|
||||
|
||||
//
|
||||
// Rescan the boot option list, avoid pertential risk of the boot
|
||||
// option change in front page
|
||||
//
|
||||
if (BootNextExist) {
|
||||
LinkBootNext = BootLists.ForwardLink;
|
||||
}
|
||||
|
||||
InitializeListHead (&BootLists);
|
||||
if (LinkBootNext != NULL) {
|
||||
//
|
||||
// Reserve the boot next option
|
||||
//
|
||||
InsertTailList (&BootLists, LinkBootNext);
|
||||
}
|
||||
|
||||
BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
|
||||
Link = BootLists.ForwardLink;
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BdsEntry (
|
||||
IN EFI_BDS_ARCH_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Service routine for BdsInstance->Entry(). Devices are connected, the
|
||||
consoles are initialized, and the boot options are tried.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Protocol Instance structure.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - BDS->Entry has finished executing.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData;
|
||||
LIST_ENTRY DriverOptionList;
|
||||
LIST_ENTRY BootOptionList;
|
||||
UINTN BootNextSize;
|
||||
|
||||
//
|
||||
// Insert the performance probe
|
||||
//
|
||||
PERF_END (0, DXE_TOK, NULL, 0);
|
||||
PERF_START (0, BDS_TOK, NULL, 0);
|
||||
|
||||
//
|
||||
// Initialize the global system boot option and driver option
|
||||
//
|
||||
InitializeListHead (&DriverOptionList);
|
||||
InitializeListHead (&BootOptionList);
|
||||
|
||||
//
|
||||
// Get the BDS private data
|
||||
//
|
||||
PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);
|
||||
|
||||
//
|
||||
// Do the platform init, can be customized by OEM/IBV
|
||||
//
|
||||
PERF_START (0, "PlatformBds", "BDS", 0);
|
||||
PlatformBdsInit (PrivateData);
|
||||
|
||||
//
|
||||
// Set up the device list based on EFI 1.1 variables
|
||||
// process Driver#### and Load the driver's in the
|
||||
// driver option list
|
||||
//
|
||||
BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");
|
||||
if (!IsListEmpty (&DriverOptionList)) {
|
||||
BdsLibLoadDrivers (&DriverOptionList);
|
||||
}
|
||||
//
|
||||
// Check if we have the boot next option
|
||||
//
|
||||
mBootNext = BdsLibGetVariableAndSize (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&BootNextSize
|
||||
);
|
||||
|
||||
//
|
||||
// Setup some platform policy here
|
||||
//
|
||||
PlatformBdsPolicyBehavior (PrivateData, &DriverOptionList, &BootOptionList);
|
||||
PERF_END (0, L"PlatformBds", L"BDS", 0);
|
||||
|
||||
//
|
||||
// BDS select the boot device to load OS
|
||||
//
|
||||
BdsBootDeviceSelect ();
|
||||
|
||||
//
|
||||
// Only assert here since this is the right behavior, we should never
|
||||
// return back to DxeCore.
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
1515
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c
Normal file
1515
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.c
Normal file
File diff suppressed because it is too large
Load Diff
83
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.h
Normal file
83
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BBSsupport.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BBSsupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
declares interface functions
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_BDS_BBS_SUPPORT_H
|
||||
#define _EFI_BDS_BBS_SUPPORT_H
|
||||
|
||||
#include "Generic/BootMaint/BootMaint.h"
|
||||
|
||||
#ifdef EFI32
|
||||
#define REFRESH_LEGACY_BOOT_OPTIONS \
|
||||
BdsDeleteAllInvalidLegacyBootOptions ();\
|
||||
BdsAddNonExistingLegacyBootOptions (); \
|
||||
BdsUpdateLegacyDevOrder ()
|
||||
#else
|
||||
#define REFRESH_LEGACY_BOOT_OPTIONS
|
||||
#endif
|
||||
|
||||
VOID
|
||||
BdsBuildLegacyDevNameString (
|
||||
IN BBS_TABLE *CurBBSEntry,
|
||||
IN UINTN Index,
|
||||
IN UINTN BufSize,
|
||||
OUT CHAR16 *BootString
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsDeleteAllInvalidLegacyBootOptions (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsAddNonExistingLegacyBootOptions (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Add the legacy boot options from BBS table if they do not exist.
|
||||
|
||||
Arguments:
|
||||
|
||||
None.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
|
||||
others - An error occurred when creating legacy boot options.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BdsUpdateLegacyDevOrder (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
BdsRefreshBbsTableForBoot (
|
||||
IN BDS_COMMON_OPTION *Entry
|
||||
);
|
||||
|
||||
#endif
|
626
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c
Normal file
626
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BmLib.c
Normal file
@@ -0,0 +1,626 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
bmlib.c
|
||||
|
||||
AgBStract:
|
||||
|
||||
Boot Maintainence Helper functions
|
||||
|
||||
--*/
|
||||
|
||||
#include "bootmaint.h"
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibLocateProtocol (
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
OUT VOID **Interface
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Find the first instance of this Protocol
|
||||
in the system and return it's interface
|
||||
|
||||
Arguments:
|
||||
|
||||
ProtocolGuid - Provides the protocol to search for
|
||||
Interface - On return, a pointer to the first interface
|
||||
that matches ProtocolGuid
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - A protocol instance matching ProtocolGuid was found
|
||||
|
||||
EFI_NOT_FOUND - No protocol instances were found that match ProtocolGuid
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
ProtocolGuid,
|
||||
NULL,
|
||||
Interface
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_FILE_HANDLE
|
||||
EfiLibOpenRoot (
|
||||
IN EFI_HANDLE DeviceHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function opens and returns a file handle to the root directory of a volume.
|
||||
|
||||
Arguments:
|
||||
|
||||
DeviceHandle - A handle for a device
|
||||
|
||||
Returns:
|
||||
|
||||
A valid file handle or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
|
||||
EFI_FILE_HANDLE File;
|
||||
|
||||
File = NULL;
|
||||
|
||||
//
|
||||
// File the file system interface to the device
|
||||
//
|
||||
Status = gBS->HandleProtocol (
|
||||
DeviceHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
(VOID *) &Volume
|
||||
);
|
||||
|
||||
//
|
||||
// Open the root directory of the volume
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = Volume->OpenVolume (
|
||||
Volume,
|
||||
&File
|
||||
);
|
||||
}
|
||||
//
|
||||
// Done
|
||||
//
|
||||
return EFI_ERROR (Status) ? NULL : File;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EfiGrowBuffer (
|
||||
IN OUT EFI_STATUS *Status,
|
||||
IN OUT VOID **Buffer,
|
||||
IN UINTN BufferSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Helper function called as part of the code needed
|
||||
to allocate the proper sized buffer for various
|
||||
EFI interfaces.
|
||||
|
||||
Arguments:
|
||||
|
||||
Status - Current status
|
||||
|
||||
Buffer - Current allocated buffer, or NULL
|
||||
|
||||
BufferSize - Current buffer size needed
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE - if the buffer was reallocated and the caller
|
||||
should try the API again.
|
||||
|
||||
--*/
|
||||
{
|
||||
BOOLEAN TryAgain;
|
||||
|
||||
//
|
||||
// If this is an initial request, buffer will be null with a new buffer size
|
||||
//
|
||||
if (!*Buffer && BufferSize) {
|
||||
*Status = EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
//
|
||||
// If the status code is "buffer too small", resize the buffer
|
||||
//
|
||||
TryAgain = FALSE;
|
||||
if (*Status == EFI_BUFFER_TOO_SMALL) {
|
||||
|
||||
SafeFreePool (*Buffer);
|
||||
|
||||
*Buffer = AllocateZeroPool (BufferSize);
|
||||
|
||||
if (*Buffer) {
|
||||
TryAgain = TRUE;
|
||||
} else {
|
||||
*Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
//
|
||||
// If there's an error, free the buffer
|
||||
//
|
||||
if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {
|
||||
SafeFreePool (*Buffer);
|
||||
*Buffer = NULL;
|
||||
}
|
||||
|
||||
return TryAgain;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EfiLibGetVariable (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function returns the value of the specified variable.
|
||||
|
||||
Arguments:
|
||||
Name - A Null-terminated Unicode string that is
|
||||
the name of the vendor's variable.
|
||||
|
||||
VendorGuid - A unique identifier for the vendor.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN VarSize;
|
||||
|
||||
return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibDeleteVariable (
|
||||
IN CHAR16 *VarName,
|
||||
IN EFI_GUID *VarGuid
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function deletes the variable specified by VarName and VarGuid.
|
||||
|
||||
Arguments:
|
||||
VarName - A Null-terminated Unicode string that is
|
||||
the name of the vendor's variable.
|
||||
|
||||
VendorGuid - A unique identifier for the vendor.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The variable was found and removed
|
||||
|
||||
EFI_UNSUPPORTED - The variable store was inaccessible
|
||||
|
||||
EFI_OUT_OF_RESOURCES - The temporary buffer was not available
|
||||
|
||||
EFI_NOT_FOUND - The variable was not found
|
||||
|
||||
--*/
|
||||
{
|
||||
VOID *VarBuf;
|
||||
EFI_STATUS Status;
|
||||
|
||||
VarBuf = EfiLibGetVariable (VarName, VarGuid);
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
if (VarBuf) {
|
||||
//
|
||||
// Delete variable from Storage
|
||||
//
|
||||
Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
SafeFreePool (VarBuf);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
|
||||
EfiLibFileSystemVolumeLabelInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function gets the file system information from an open file descriptor,
|
||||
and stores it in a buffer allocated from pool.
|
||||
|
||||
Arguments:
|
||||
|
||||
Fhand - A file handle
|
||||
|
||||
Returns:
|
||||
|
||||
A pointer to a buffer with file information or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer;
|
||||
UINTN BufferSize;
|
||||
//
|
||||
// Initialize for GrowBuffer loop
|
||||
//
|
||||
Buffer = NULL;
|
||||
BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;
|
||||
|
||||
//
|
||||
// Call the real function
|
||||
//
|
||||
while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
|
||||
Status = FHand->GetInfo (
|
||||
FHand,
|
||||
&gEfiFileSystemVolumeLabelInfoIdGuid,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
CHAR16 *
|
||||
EfiStrDuplicate (
|
||||
IN CHAR16 *Src
|
||||
)
|
||||
{
|
||||
CHAR16 *Dest;
|
||||
UINTN Size;
|
||||
|
||||
Size = StrSize (Src);
|
||||
Dest = AllocateZeroPool (Size);
|
||||
ASSERT (Dest != NULL);
|
||||
if (Dest) {
|
||||
CopyMem (Dest, Src, Size);
|
||||
}
|
||||
|
||||
return Dest;
|
||||
}
|
||||
|
||||
EFI_FILE_INFO *
|
||||
EfiLibFileInfo (
|
||||
IN EFI_FILE_HANDLE FHand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Function gets the file information from an open file descriptor, and stores it
|
||||
in a buffer allocated from pool.
|
||||
|
||||
Arguments:
|
||||
|
||||
Fhand - A file handle
|
||||
|
||||
Returns:
|
||||
|
||||
A pointer to a buffer with file information or NULL is returned
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE_INFO *Buffer;
|
||||
UINTN BufferSize;
|
||||
|
||||
//
|
||||
// Initialize for GrowBuffer loop
|
||||
//
|
||||
Buffer = NULL;
|
||||
BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
|
||||
|
||||
//
|
||||
// Call the real function
|
||||
//
|
||||
while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
|
||||
Status = FHand->GetInfo (
|
||||
FHand,
|
||||
&gEfiFileInfoGuid,
|
||||
&BufferSize,
|
||||
Buffer
|
||||
);
|
||||
}
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
UINTN
|
||||
EfiDevicePathInstanceCount (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function is used to determine the number of device path instances
|
||||
that exist in a device path.
|
||||
|
||||
Arguments:
|
||||
DevicePath - A pointer to a device path data structure.
|
||||
|
||||
Returns:
|
||||
|
||||
This function counts and returns the number of device path instances
|
||||
in DevicePath.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Count;
|
||||
UINTN Size;
|
||||
|
||||
Count = 0;
|
||||
while (GetNextDevicePathInstance (&DevicePath, &Size)) {
|
||||
Count += 1;
|
||||
}
|
||||
|
||||
return Count;
|
||||
}
|
||||
|
||||
VOID *
|
||||
EfiReallocatePool (
|
||||
IN VOID *OldPool,
|
||||
IN UINTN OldSize,
|
||||
IN UINTN NewSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Adjusts the size of a previously allocated buffer.
|
||||
|
||||
Arguments:
|
||||
OldPool - A pointer to the buffer whose size is being adjusted.
|
||||
OldSize - The size of the current buffer.
|
||||
NewSize - The size of the new buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCEESS - The requested number of bytes were allocated.
|
||||
|
||||
EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
|
||||
|
||||
EFI_INVALID_PARAMETER - The buffer was invalid.
|
||||
|
||||
--*/
|
||||
{
|
||||
VOID *NewPool;
|
||||
|
||||
NewPool = NULL;
|
||||
if (NewSize) {
|
||||
NewPool = AllocateZeroPool (NewSize);
|
||||
}
|
||||
|
||||
if (OldPool) {
|
||||
if (NewPool) {
|
||||
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
|
||||
}
|
||||
|
||||
SafeFreePool (OldPool);
|
||||
}
|
||||
|
||||
return NewPool;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EfiLibGetStringFromToken (
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN STRING_REF Token,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Acquire the string associated with the ProducerGuid and return it.
|
||||
|
||||
Arguments:
|
||||
|
||||
ProducerGuid - The Guid to search the HII database for
|
||||
Token - The token value of the string to extract
|
||||
String - The string that is extracted
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
|
||||
was updated.
|
||||
EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 HandleBufferLength;
|
||||
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||
UINTN StringBufferLength;
|
||||
UINTN NumberOfHiiHandles;
|
||||
UINTN Index;
|
||||
UINT16 Length;
|
||||
EFI_GUID HiiGuid;
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
|
||||
HandleBufferLength = 0x1000;
|
||||
HiiHandleBuffer = NULL;
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiProtocolGuid,
|
||||
NULL,
|
||||
&Hii
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
*String = NULL;
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Get all the Hii handles
|
||||
//
|
||||
HiiHandleBuffer = AllocateZeroPool (HandleBufferLength);
|
||||
ASSERT (HiiHandleBuffer != NULL);
|
||||
|
||||
Status = Hii->FindHandles (Hii, &HandleBufferLength, HiiHandleBuffer);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Get the Hii Handle that matches the StructureNode->ProducerName
|
||||
//
|
||||
NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
|
||||
for (Index = 0; Index < NumberOfHiiHandles; Index++) {
|
||||
Length = 0;
|
||||
Status = ExtractDataFromHiiHandle (
|
||||
HiiHandleBuffer[Index],
|
||||
&Length,
|
||||
NULL,
|
||||
&HiiGuid
|
||||
);
|
||||
if (CompareGuid (ProducerGuid, &HiiGuid)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Find the string based on the current language
|
||||
//
|
||||
StringBufferLength = 0x100;
|
||||
*String = AllocateZeroPool (0x100);
|
||||
ASSERT (*String != NULL);
|
||||
|
||||
Status = Hii->GetString (
|
||||
Hii,
|
||||
HiiHandleBuffer[Index],
|
||||
Token,
|
||||
FALSE,
|
||||
NULL,
|
||||
&StringBufferLength,
|
||||
*String
|
||||
);
|
||||
|
||||
gBS->FreePool (HiiHandleBuffer);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
TimeCompare (
|
||||
IN EFI_TIME *FirstTime,
|
||||
IN EFI_TIME *SecondTime
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Compare two EFI_TIME data.
|
||||
|
||||
Arguments:
|
||||
|
||||
FirstTime - A pointer to the first EFI_TIME data.
|
||||
SecondTime - A pointer to the second EFI_TIME data.
|
||||
|
||||
Returns:
|
||||
TRUE The FirstTime is not later than the SecondTime.
|
||||
FALSE The FirstTime is later than the SecondTime.
|
||||
|
||||
--*/
|
||||
{
|
||||
if (FirstTime->Year != SecondTime->Year) {
|
||||
return (BOOLEAN) (FirstTime->Year < SecondTime->Year);
|
||||
} else if (FirstTime->Month != SecondTime->Month) {
|
||||
return (BOOLEAN) (FirstTime->Month < SecondTime->Month);
|
||||
} else if (FirstTime->Day != SecondTime->Day) {
|
||||
return (BOOLEAN) (FirstTime->Day < SecondTime->Day);
|
||||
} else if (FirstTime->Hour != SecondTime->Hour) {
|
||||
return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour);
|
||||
} else if (FirstTime->Minute != SecondTime->Minute) {
|
||||
return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute);
|
||||
} else if (FirstTime->Second != SecondTime->Second) {
|
||||
return (BOOLEAN) (FirstTime->Second < SecondTime->Second);
|
||||
}
|
||||
|
||||
return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond);
|
||||
}
|
||||
|
||||
UINT16 *
|
||||
EfiLibStrFromDatahub (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 *Desc;
|
||||
EFI_DATA_HUB_PROTOCOL *Datahub;
|
||||
UINT64 Count;
|
||||
EFI_DATA_RECORD_HEADER *Record;
|
||||
EFI_SUBCLASS_TYPE1_HEADER *DataHdr;
|
||||
EFI_GUID MiscGuid = EFI_MISC_SUBCLASS_GUID;
|
||||
EFI_MISC_ONBOARD_DEVICE_DATA *ob;
|
||||
EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Port;
|
||||
EFI_TIME CurTime;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDataHubProtocolGuid,
|
||||
NULL,
|
||||
&Datahub
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = gRT->GetTime (&CurTime, NULL);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Count = 0;
|
||||
do {
|
||||
Status = Datahub->GetNextRecord (Datahub, &Count, NULL, &Record);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA && CompareGuid (&Record->DataRecordGuid, &MiscGuid)) {
|
||||
//
|
||||
// This record is what we need
|
||||
//
|
||||
DataHdr = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
|
||||
if (EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER == DataHdr->RecordType) {
|
||||
ob = (EFI_MISC_ONBOARD_DEVICE_DATA *) (DataHdr + 1);
|
||||
if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &ob->OnBoardDevicePath, DevPath)) {
|
||||
EfiLibGetStringFromToken (&Record->ProducerName, ob->OnBoardDeviceDescription, &Desc);
|
||||
return Desc;
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER == DataHdr->RecordType) {
|
||||
Port = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) (DataHdr + 1);
|
||||
if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &Port->PortPath, DevPath)) {
|
||||
EfiLibGetStringFromToken (&Record->ProducerName, Port->PortExternalConnectorDesignator, &Desc);
|
||||
return Desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (TimeCompare (&Record->LogTime, &CurTime) && Count != 0);
|
||||
|
||||
return NULL;
|
||||
}
|
1305
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c
Normal file
1305
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.c
Normal file
File diff suppressed because it is too large
Load Diff
1161
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.h
Normal file
1161
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootMaint.h
Normal file
File diff suppressed because it is too large
Load Diff
1657
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c
Normal file
1657
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/BootOption.c
Normal file
File diff suppressed because it is too large
Load Diff
840
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/ConsoleOption.c
Normal file
840
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/ConsoleOption.c
Normal file
@@ -0,0 +1,840 @@
|
||||
/*++
|
||||
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:
|
||||
|
||||
consoleoption.c
|
||||
|
||||
Abstract:
|
||||
|
||||
handles console redirection from boot manager
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "bootmaint.h"
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
DevicePathInstanceDup (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
UpdateComAttributeFromVariable (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
ChangeTerminalDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
BOOLEAN ChangeTerminal
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node1;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
UART_DEVICE_PATH *Uart1;
|
||||
UINTN Com;
|
||||
UINT32 Match;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
Com = 0;
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
|
||||
}
|
||||
}
|
||||
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
|
||||
if (NULL == NewMenuEntry) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
|
||||
Uart = (UART_DEVICE_PATH *) Node;
|
||||
CopyMem (
|
||||
&Uart->BaudRate,
|
||||
&NewTerminalContext->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->DataBits,
|
||||
&NewTerminalContext->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->Parity,
|
||||
&NewTerminalContext->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->StopBits,
|
||||
&NewTerminalContext->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
//
|
||||
// Change the device path in the ComPort
|
||||
//
|
||||
if (ChangeTerminal) {
|
||||
Node1 = NewTerminalContext->DevicePath;
|
||||
Node1 = NextDevicePathNode (Node1);
|
||||
while (!IsDevicePathEnd (Node1)) {
|
||||
if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {
|
||||
Uart1 = (UART_DEVICE_PATH *) Node1;
|
||||
CopyMem (
|
||||
&Uart1->BaudRate,
|
||||
&NewTerminalContext->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart1->DataBits,
|
||||
&NewTerminalContext->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart1->Parity,
|
||||
&NewTerminalContext->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart1->StopBits,
|
||||
&NewTerminalContext->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
break;
|
||||
}
|
||||
//
|
||||
// end if
|
||||
//
|
||||
Node1 = NextDevicePathNode (Node1);
|
||||
}
|
||||
//
|
||||
// end while
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Node = NextDevicePathNode (Node);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
VOID
|
||||
ChangeVariableDevicePath (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
UINTN Com;
|
||||
UINT32 Match;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
Com = 0;
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
|
||||
}
|
||||
}
|
||||
|
||||
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (
|
||||
&TerminalMenu,
|
||||
Com
|
||||
);
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
Uart = (UART_DEVICE_PATH *) Node;
|
||||
CopyMem (
|
||||
&Uart->BaudRate,
|
||||
&NewTerminalContext->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->DataBits,
|
||||
&NewTerminalContext->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->Parity,
|
||||
&NewTerminalContext->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart->StopBits,
|
||||
&NewTerminalContext->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
}
|
||||
|
||||
Node = NextDevicePathNode (Node);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsTerminalDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT TYPE_OF_TERMINAL *Termi,
|
||||
OUT UINTN *Com
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LocateSerialIo (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Build a list containing all serial devices
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Ptr;
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
UINTN NoHandles;
|
||||
EFI_HANDLE *Handles;
|
||||
EFI_STATUS Status;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
UINT32 Match;
|
||||
EFI_SERIAL_IO_PROTOCOL *SerialIo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
|
||||
VENDOR_DEVICE_PATH Vendor;
|
||||
//
|
||||
// Get all handles that have SerialIo protocol installed
|
||||
//
|
||||
InitializeListHead (&TerminalMenu.Head);
|
||||
TerminalMenu.MenuNumber = 0;
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiSerialIoProtocolGuid,
|
||||
NULL,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// No serial ports present
|
||||
//
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < NoHandles; Index++) {
|
||||
//
|
||||
// Check to see whether the handle has DevicePath Protocol installed
|
||||
//
|
||||
gBS->HandleProtocol (
|
||||
Handles[Index],
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&DevicePath
|
||||
);
|
||||
Ptr = (UINT8 *) DevicePath;
|
||||
while (*Ptr != END_DEVICE_PATH_TYPE) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
|
||||
if (!NewMenuEntry) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
|
||||
NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath);
|
||||
//
|
||||
// BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
|
||||
// coz' the misc data for each platform is not correct, actually it's the device path stored in
|
||||
// datahub which is not completed, so a searching for end of device path will enter a
|
||||
// dead-loop.
|
||||
//
|
||||
NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);
|
||||
if (NULL == NewMenuEntry->DisplayString) {
|
||||
NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);
|
||||
}
|
||||
|
||||
NewMenuEntry->HelpString = NULL;
|
||||
|
||||
gBS->HandleProtocol (
|
||||
Handles[Index],
|
||||
&gEfiSerialIoProtocolGuid,
|
||||
&SerialIo
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->BaudRate,
|
||||
&SerialIo->Mode->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->DataBits,
|
||||
&SerialIo->Mode->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->Parity,
|
||||
&SerialIo->Mode->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->StopBits,
|
||||
&SerialIo->Mode->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
|
||||
TerminalMenu.MenuNumber++;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
|
||||
//
|
||||
OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
|
||||
InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
|
||||
ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
|
||||
if (OutDevicePath) {
|
||||
UpdateComAttributeFromVariable (OutDevicePath);
|
||||
}
|
||||
|
||||
if (InpDevicePath) {
|
||||
UpdateComAttributeFromVariable (InpDevicePath);
|
||||
}
|
||||
|
||||
if (ErrDevicePath) {
|
||||
UpdateComAttributeFromVariable (ErrDevicePath);
|
||||
}
|
||||
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
|
||||
if (NULL == NewMenuEntry) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
|
||||
NewTerminalContext->TerminalType = 0;
|
||||
NewTerminalContext->IsConIn = FALSE;
|
||||
NewTerminalContext->IsConOut = FALSE;
|
||||
NewTerminalContext->IsStdErr = FALSE;
|
||||
|
||||
Vendor.Header.Type = MESSAGING_DEVICE_PATH;
|
||||
Vendor.Header.SubType = MSG_VENDOR_DP;
|
||||
|
||||
for (Index2 = 0; Index2 < 4; Index2++) {
|
||||
CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));
|
||||
SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
|
||||
NewDevicePath = AppendDevicePathNode (
|
||||
NewTerminalContext->DevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &Vendor
|
||||
);
|
||||
SafeFreePool (NewMenuEntry->HelpString);
|
||||
//
|
||||
// NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
|
||||
// NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
|
||||
//
|
||||
NewMenuEntry->HelpString = NULL;
|
||||
|
||||
if (BdsLibMatchDevicePaths (OutDevicePath, NewDevicePath)) {
|
||||
NewTerminalContext->IsConOut = TRUE;
|
||||
NewTerminalContext->TerminalType = (UINT8) Index2;
|
||||
}
|
||||
|
||||
if (BdsLibMatchDevicePaths (InpDevicePath, NewDevicePath)) {
|
||||
NewTerminalContext->IsConIn = TRUE;
|
||||
NewTerminalContext->TerminalType = (UINT8) Index2;
|
||||
}
|
||||
|
||||
if (BdsLibMatchDevicePaths (ErrDevicePath, NewDevicePath)) {
|
||||
NewTerminalContext->IsStdErr = TRUE;
|
||||
NewTerminalContext->TerminalType = (UINT8) Index2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
UpdateComAttributeFromVariable (
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Update Com Ports attributes from DevicePath
|
||||
|
||||
Arguments:
|
||||
DevicePath - DevicePath that contains Com ports
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *Node;
|
||||
EFI_DEVICE_PATH_PROTOCOL *SerialNode;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UART_DEVICE_PATH *Uart;
|
||||
UART_DEVICE_PATH *Uart1;
|
||||
UINT32 Match;
|
||||
UINTN TerminalNumber;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
UINTN Index;
|
||||
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
Node = DevicePath;
|
||||
Node = NextDevicePathNode (Node);
|
||||
TerminalNumber = 0;
|
||||
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
|
||||
while (!IsDevicePathEnd (Node)) {
|
||||
if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Node;
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
|
||||
}
|
||||
}
|
||||
|
||||
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
|
||||
Uart = (UART_DEVICE_PATH *) Node;
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalNumber);
|
||||
if (NULL == NewMenuEntry) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
CopyMem (
|
||||
&NewTerminalContext->BaudRate,
|
||||
&Uart->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->DataBits,
|
||||
&Uart->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->Parity,
|
||||
&Uart->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&NewTerminalContext->StopBits,
|
||||
&Uart->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
SerialNode = NewTerminalContext->DevicePath;
|
||||
SerialNode = NextDevicePathNode (SerialNode);
|
||||
while (!IsDevicePathEnd (SerialNode)) {
|
||||
if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {
|
||||
//
|
||||
// Update following device paths according to
|
||||
// previous acquired uart attributes
|
||||
//
|
||||
Uart1 = (UART_DEVICE_PATH *) SerialNode;
|
||||
CopyMem (
|
||||
&Uart1->BaudRate,
|
||||
&NewTerminalContext->BaudRate,
|
||||
sizeof (UINT64)
|
||||
);
|
||||
|
||||
CopyMem (
|
||||
&Uart1->DataBits,
|
||||
&NewTerminalContext->DataBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
CopyMem (
|
||||
&Uart1->Parity,
|
||||
&NewTerminalContext->Parity,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
CopyMem (
|
||||
&Uart1->StopBits,
|
||||
&NewTerminalContext->StopBits,
|
||||
sizeof (UINT8)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
SerialNode = NextDevicePathNode (SerialNode);
|
||||
}
|
||||
//
|
||||
// end while
|
||||
//
|
||||
}
|
||||
|
||||
Node = NextDevicePathNode (Node);
|
||||
}
|
||||
//
|
||||
// end while
|
||||
//
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
DevicePathInstanceDup (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Function creates a device path data structure that identically matches the
|
||||
device path passed in.
|
||||
|
||||
Arguments:
|
||||
DevPath - A pointer to a device path data structure.
|
||||
|
||||
Returns:
|
||||
|
||||
The new copy of DevPath is created to identically match the input.
|
||||
Otherwise, NULL is returned.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
EFI_DEVICE_PATH_PROTOCOL *Temp;
|
||||
UINT8 *Ptr;
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// get the size of an instance from the input
|
||||
//
|
||||
Temp = DevPath;
|
||||
DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
|
||||
|
||||
//
|
||||
// Make a copy and set proper end type
|
||||
//
|
||||
NewDevPath = NULL;
|
||||
if (Size) {
|
||||
NewDevPath = AllocateZeroPool (Size);
|
||||
ASSERT (NewDevPath != NULL);
|
||||
}
|
||||
|
||||
if (NewDevPath) {
|
||||
CopyMem (NewDevPath, DevicePathInst, Size);
|
||||
Ptr = (UINT8 *) NewDevPath;
|
||||
Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
||||
Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
|
||||
SetDevicePathEndNode (Temp);
|
||||
}
|
||||
|
||||
return NewDevPath;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetConsoleMenu (
|
||||
IN UINTN ConsoleMenuType
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *AllDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *MultiDevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
|
||||
UINTN Size;
|
||||
UINTN AllCount;
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_CONSOLE_CONTEXT *NewConsoleContext;
|
||||
BM_TERMINAL_CONTEXT *NewTerminalContext;
|
||||
TYPE_OF_TERMINAL Terminal;
|
||||
BM_MENU_ENTRY *NewTerminalMenuEntry;
|
||||
UINTN Com;
|
||||
BM_MENU_OPTION *ConsoleMenu;
|
||||
|
||||
DevicePath = NULL;
|
||||
AllDevicePath = NULL;
|
||||
AllCount = 0;
|
||||
switch (ConsoleMenuType) {
|
||||
case BM_CONSOLE_IN_CONTEXT_SELECT:
|
||||
ConsoleMenu = &ConsoleInpMenu;
|
||||
DevicePath = EfiLibGetVariable (
|
||||
L"ConIn",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
|
||||
AllDevicePath = EfiLibGetVariable (
|
||||
L"ConInDev",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
break;
|
||||
|
||||
case BM_CONSOLE_OUT_CONTEXT_SELECT:
|
||||
ConsoleMenu = &ConsoleOutMenu;
|
||||
DevicePath = EfiLibGetVariable (
|
||||
L"ConOut",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
|
||||
AllDevicePath = EfiLibGetVariable (
|
||||
L"ConOutDev",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
break;
|
||||
|
||||
case BM_CONSOLE_ERR_CONTEXT_SELECT:
|
||||
ConsoleMenu = &ConsoleErrMenu;
|
||||
DevicePath = EfiLibGetVariable (
|
||||
L"ErrOut",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
|
||||
AllDevicePath = EfiLibGetVariable (
|
||||
L"ErrOutDev",
|
||||
&gEfiGlobalVariableGuid
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (NULL == AllDevicePath) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
InitializeListHead (&ConsoleMenu->Head);
|
||||
|
||||
AllCount = EfiDevicePathInstanceCount (AllDevicePath);
|
||||
ConsoleMenu->MenuNumber = 0;
|
||||
//
|
||||
// Following is menu building up for Console Out Devices
|
||||
//
|
||||
MultiDevicePath = AllDevicePath;
|
||||
Index2 = 0;
|
||||
for (Index = 0; Index < AllCount; Index++) {
|
||||
DevicePathInst = GetNextDevicePathInstance (&MultiDevicePath, &Size);
|
||||
|
||||
NewMenuEntry = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);
|
||||
if (NULL == NewMenuEntry) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
NewMenuEntry->OptionNumber = Index2;
|
||||
|
||||
NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst);
|
||||
NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);
|
||||
if (NULL == NewMenuEntry->DisplayString) {
|
||||
NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);
|
||||
}
|
||||
|
||||
NewConsoleContext->IsTerminal = IsTerminalDevicePath (
|
||||
NewConsoleContext->DevicePath,
|
||||
&Terminal,
|
||||
&Com
|
||||
);
|
||||
|
||||
NewConsoleContext->IsActive = BdsLibMatchDevicePaths (
|
||||
DevicePath,
|
||||
NewConsoleContext->DevicePath
|
||||
);
|
||||
NewTerminalMenuEntry = NULL;
|
||||
NewTerminalContext = NULL;
|
||||
|
||||
if (NewConsoleContext->IsTerminal) {
|
||||
BOpt_DestroyMenuEntry (NewMenuEntry);
|
||||
} else {
|
||||
Index2++;
|
||||
ConsoleMenu->MenuNumber++;
|
||||
InsertTailList (&ConsoleMenu->Head, &NewMenuEntry->Link);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetAllConsoles (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS
|
||||
Others
|
||||
|
||||
--*/
|
||||
{
|
||||
GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);
|
||||
GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);
|
||||
GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
FreeAllConsoles (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS
|
||||
Others
|
||||
|
||||
--*/
|
||||
{
|
||||
BOpt_FreeMenu (&ConsoleOutMenu);
|
||||
BOpt_FreeMenu (&ConsoleInpMenu);
|
||||
BOpt_FreeMenu (&ConsoleErrMenu);
|
||||
BOpt_FreeMenu (&TerminalMenu);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsTerminalDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT TYPE_OF_TERMINAL *Termi,
|
||||
OUT UINTN *Com
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Test whether DevicePath is a valid Terminal
|
||||
|
||||
Arguments:
|
||||
DevicePath - DevicePath to be checked
|
||||
Termi - If is terminal, give its type
|
||||
Com - If is Com Port, give its type
|
||||
|
||||
Returns:
|
||||
TRUE - If DevicePath point to a Terminal
|
||||
FALSE
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Ptr;
|
||||
BOOLEAN IsTerminal;
|
||||
VENDOR_DEVICE_PATH *Vendor;
|
||||
ACPI_HID_DEVICE_PATH *Acpi;
|
||||
UINT32 Match;
|
||||
EFI_GUID TempGuid;
|
||||
|
||||
IsTerminal = FALSE;
|
||||
|
||||
//
|
||||
// Parse the Device Path, should be change later!!!
|
||||
//
|
||||
Ptr = (UINT8 *) DevicePath;
|
||||
while (*Ptr != END_DEVICE_PATH_TYPE) {
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (VENDOR_DEVICE_PATH);
|
||||
Vendor = (VENDOR_DEVICE_PATH *) Ptr;
|
||||
|
||||
//
|
||||
// There are four kinds of Terminal types
|
||||
// check to see whether this devicepath
|
||||
// is one of that type
|
||||
//
|
||||
CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));
|
||||
|
||||
if (CompareGuid (&TempGuid, &Guid[0])) {
|
||||
*Termi = PC_ANSI;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[1])) {
|
||||
*Termi = VT_100;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[2])) {
|
||||
*Termi = VT_100_PLUS;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
if (CompareGuid (&TempGuid, &Guid[3])) {
|
||||
*Termi = VT_UTF8;
|
||||
IsTerminal = TRUE;
|
||||
} else {
|
||||
IsTerminal = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsTerminal) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
|
||||
Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
|
||||
Match = EISA_PNP_ID (0x0501);
|
||||
if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
|
||||
CopyMem (Com, &Acpi->UID, sizeof (UINT32));
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
324
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Data.c
Normal file
324
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Data.c
Normal file
@@ -0,0 +1,324 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
data.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Define some data used for Boot Maint
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "bootmaint.h"
|
||||
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
STRING_DEPOSITORY *FileOptionStrDepository;
|
||||
STRING_DEPOSITORY *ConsoleOptionStrDepository;
|
||||
STRING_DEPOSITORY *BootOptionStrDepository;
|
||||
STRING_DEPOSITORY *BootOptionHelpStrDepository;
|
||||
STRING_DEPOSITORY *DriverOptionStrDepository;
|
||||
STRING_DEPOSITORY *DriverOptionHelpStrDepository;
|
||||
STRING_DEPOSITORY *TerminalStrDepository;
|
||||
|
||||
//
|
||||
// Terminal type string token storage
|
||||
//
|
||||
UINT16 TerminalType[] = {
|
||||
STRING_TOKEN(STR_COM_TYPE_0),
|
||||
STRING_TOKEN(STR_COM_TYPE_1),
|
||||
STRING_TOKEN(STR_COM_TYPE_2),
|
||||
STRING_TOKEN(STR_COM_TYPE_3),
|
||||
};
|
||||
|
||||
//
|
||||
// File system selection menu
|
||||
//
|
||||
BM_MENU_OPTION FsOptionMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Console Input Device Selection Menu
|
||||
//
|
||||
BM_MENU_OPTION ConsoleInpMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Console Output Device Selection Menu
|
||||
//
|
||||
BM_MENU_OPTION ConsoleOutMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Error Output Device Selection Menu
|
||||
//
|
||||
BM_MENU_OPTION ConsoleErrMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Boot Option from variable Menu
|
||||
//
|
||||
BM_MENU_OPTION BootOptionMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Driver Option from variable menu
|
||||
//
|
||||
BM_MENU_OPTION DriverOptionMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Legacy FD Info from LegacyBios.GetBbsInfo()
|
||||
//
|
||||
BM_MENU_OPTION LegacyFDMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Legacy HD Info from LegacyBios.GetBbsInfo()
|
||||
//
|
||||
BM_MENU_OPTION LegacyHDMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Legacy CD Info from LegacyBios.GetBbsInfo()
|
||||
//
|
||||
BM_MENU_OPTION LegacyCDMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Legacy NET Info from LegacyBios.GetBbsInfo()
|
||||
//
|
||||
BM_MENU_OPTION LegacyNETMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Legacy NET Info from LegacyBios.GetBbsInfo()
|
||||
//
|
||||
BM_MENU_OPTION LegacyBEVMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Files and sub-directories in current directory menu
|
||||
//
|
||||
BM_MENU_OPTION DirectoryMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Handles in current system selection menu
|
||||
//
|
||||
BM_MENU_OPTION DriverMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
BM_MENU_OPTION TerminalMenu = {
|
||||
BM_MENU_OPTION_SIGNATURE,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
//
|
||||
// Value and string token correspondency for BaudRate
|
||||
//
|
||||
COM_ATTR BaudRateList[19] = {
|
||||
{
|
||||
115200,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_0)
|
||||
},
|
||||
{
|
||||
57600,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_1)
|
||||
},
|
||||
{
|
||||
38400,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_2)
|
||||
},
|
||||
{
|
||||
19200,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_3)
|
||||
},
|
||||
{
|
||||
9600,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_4)
|
||||
},
|
||||
{
|
||||
7200,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_5)
|
||||
},
|
||||
{
|
||||
4800,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_6)
|
||||
},
|
||||
{
|
||||
3600,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_7)
|
||||
},
|
||||
{
|
||||
2400,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_8)
|
||||
},
|
||||
{
|
||||
2000,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_9)
|
||||
},
|
||||
{
|
||||
1800,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_10)
|
||||
},
|
||||
{
|
||||
1200,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_11)
|
||||
},
|
||||
{
|
||||
600,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_12)
|
||||
},
|
||||
{
|
||||
300,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_13)
|
||||
},
|
||||
{
|
||||
150,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_14)
|
||||
},
|
||||
{
|
||||
134,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_15)
|
||||
},
|
||||
{
|
||||
110,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_16)
|
||||
},
|
||||
{
|
||||
75,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_17)
|
||||
},
|
||||
{
|
||||
50,
|
||||
STRING_TOKEN(STR_COM_BAUD_RATE_18)
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Value and string token correspondency for DataBits
|
||||
//
|
||||
COM_ATTR DataBitsList[4] = {
|
||||
{
|
||||
5,
|
||||
STRING_TOKEN(STR_COM_DATA_BITS_0)
|
||||
},
|
||||
{
|
||||
6,
|
||||
STRING_TOKEN(STR_COM_DATA_BITS_1)
|
||||
},
|
||||
{
|
||||
7,
|
||||
STRING_TOKEN(STR_COM_DATA_BITS_2)
|
||||
},
|
||||
{
|
||||
8,
|
||||
STRING_TOKEN(STR_COM_DATA_BITS_3)
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Value and string token correspondency for Parity
|
||||
//
|
||||
COM_ATTR ParityList[5] = {
|
||||
{
|
||||
NoParity,
|
||||
STRING_TOKEN(STR_COM_PAR_0)
|
||||
},
|
||||
{
|
||||
EvenParity,
|
||||
STRING_TOKEN(STR_COM_PAR_1)
|
||||
},
|
||||
{
|
||||
OddParity,
|
||||
STRING_TOKEN(STR_COM_PAR_2)
|
||||
},
|
||||
{
|
||||
MarkParity,
|
||||
STRING_TOKEN(STR_COM_PAR_3)
|
||||
},
|
||||
{
|
||||
SpaceParity,
|
||||
STRING_TOKEN(STR_COM_PAR_4)
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Value and string token correspondency for Baudreate
|
||||
//
|
||||
COM_ATTR StopBitsList[3] = {
|
||||
{
|
||||
OneStopBit,
|
||||
STRING_TOKEN(STR_COM_STOP_BITS_0)
|
||||
},
|
||||
{
|
||||
OneFiveStopBits,
|
||||
STRING_TOKEN(STR_COM_STOP_BITS_1)
|
||||
},
|
||||
{
|
||||
TwoStopBits,
|
||||
STRING_TOKEN(STR_COM_STOP_BITS_2)
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Guid for messaging path, used in Serial port setting.
|
||||
//
|
||||
EFI_GUID Guid[4] = {
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI,
|
||||
DEVICE_PATH_MESSAGING_VT_100,
|
||||
DEVICE_PATH_MESSAGING_VT_100_PLUS,
|
||||
DEVICE_PATH_MESSAGING_VT_UTF8
|
||||
};
|
138
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FE.vfr
Normal file
138
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FE.vfr
Normal file
@@ -0,0 +1,138 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// FE.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// File Explorer Formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "BdsStrDefs.h"
|
||||
#include "formguid.h"
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT16 DescriptionData[75];
|
||||
UINT16 OptionalData[127];
|
||||
UINT8 Active;
|
||||
UINT8 ForceReconnect;
|
||||
} FILE_EXPLORER_NV_DATA;
|
||||
#pragma pack()
|
||||
|
||||
#define FORM_FILE_EXPLORER_ID 0x001E
|
||||
#define FORM_BOOT_ADD_DESCRIPTION_ID 0x001F
|
||||
#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID 0x0020
|
||||
#define KEY_VALUE_SAVE_AND_EXIT 0x0090
|
||||
#define KEY_VALUE_NO_SAVE_AND_EXIT 0x0091
|
||||
|
||||
|
||||
|
||||
formset
|
||||
guid = FILE_EXPLORE_FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = 0,
|
||||
subclass = 0,
|
||||
|
||||
form formid = FORM_FILE_EXPLORER_ID,
|
||||
title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);
|
||||
|
||||
label FORM_FILE_EXPLORER_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_ADD_DESCRIPTION_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_ADD_DESC_TITLE);
|
||||
|
||||
label FORM_BOOT_ADD_DESCRIPTION_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
|
||||
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 6,
|
||||
maxsize = 75,
|
||||
endstring;
|
||||
|
||||
string varid = FILE_EXPLORER_NV_DATA.OptionalData,
|
||||
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 0,
|
||||
maxsize = 120,
|
||||
endstring;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = KEY_VALUE_SAVE_AND_EXIT;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = KEY_VALUE_NO_SAVE_AND_EXIT;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
|
||||
|
||||
label FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
|
||||
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 6,
|
||||
maxsize = 75,
|
||||
endstring;
|
||||
|
||||
string varid = FILE_EXPLORER_NV_DATA.OptionalData,
|
||||
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
minsize = 0,
|
||||
maxsize = 120,
|
||||
endstring;
|
||||
|
||||
checkbox varid = FILE_EXPLORER_NV_DATA.ForceReconnect,
|
||||
prompt = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
|
||||
help = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
|
||||
flags = 1,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = KEY_VALUE_SAVE_AND_EXIT;
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = KEY_VALUE_NO_SAVE_AND_EXIT;
|
||||
|
||||
endform;
|
||||
|
||||
endformset;
|
335
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FileExplorer.c
Normal file
335
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FileExplorer.c
Normal file
@@ -0,0 +1,335 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
FileExplorer.c
|
||||
|
||||
AgBStract:
|
||||
|
||||
File explorer related functions.
|
||||
|
||||
--*/
|
||||
|
||||
#include "Generic/Bds.h"
|
||||
#include "bootmaint.h"
|
||||
#include "BdsPlatform.h"
|
||||
|
||||
VOID
|
||||
UpdateFileExplorePage (
|
||||
IN BMM_CALLBACK_DATA *CallbackData,
|
||||
BM_MENU_OPTION *MenuOption
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
Update the File Explore page.
|
||||
|
||||
Arguments:
|
||||
MenuOption - Pointer to menu options to display.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 *Location;
|
||||
UINTN Index;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_FILE_CONTEXT *NewFileContext;
|
||||
FORM_ID FormId;
|
||||
|
||||
NewMenuEntry = NULL;
|
||||
NewFileContext = NULL;
|
||||
FormId = 0;
|
||||
|
||||
//
|
||||
// Clean up file explore page.
|
||||
//
|
||||
RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);
|
||||
|
||||
//
|
||||
// Remove all op-codes from dynamic page
|
||||
//
|
||||
CallbackData->Hii->UpdateForm (
|
||||
CallbackData->Hii,
|
||||
CallbackData->FeHiiHandle,
|
||||
FORM_FILE_EXPLORER_ID,
|
||||
FALSE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 0);
|
||||
|
||||
Location = (UINT8 *) &UpdateData->Data;
|
||||
|
||||
for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
|
||||
NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
|
||||
if (NewFileContext->IsBootLegacy) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((NewFileContext->IsDir) || (BOOT_FROM_FILE_STATE == CallbackData->FeCurrentState)) {
|
||||
//
|
||||
// Create Text opcode for directory, also create Text opcode for file in BOOT_FROM_FILE_STATE.
|
||||
//
|
||||
CreateTextOpCode (
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
STR_NULL_STRING,
|
||||
STR_NULL_STRING,
|
||||
EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
|
||||
(UINT16) (FILE_OPTION_OFFSET + Index),
|
||||
Location
|
||||
);
|
||||
} else {
|
||||
//
|
||||
// Create Goto opcode for file in ADD_BOOT_OPTION_STATE or ADD_DRIVER_OPTION_STATE.
|
||||
//
|
||||
if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
|
||||
} else if (ADD_DRIVER_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
CreateGotoOpCode (
|
||||
FormId,
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
STRING_TOKEN (STR_NULL_STRING),
|
||||
EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
|
||||
(UINT16) (FILE_OPTION_OFFSET + Index),
|
||||
Location
|
||||
);
|
||||
}
|
||||
|
||||
UpdateData->DataCount++;
|
||||
Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
|
||||
}
|
||||
|
||||
CallbackData->Hii->UpdateForm (
|
||||
CallbackData->Hii,
|
||||
CallbackData->FeHiiHandle,
|
||||
FORM_FILE_EXPLORER_ID,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
UpdateFileExplorer (
|
||||
IN BMM_CALLBACK_DATA *CallbackData,
|
||||
IN UINT16 KeyValue
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Update the file explower page with the refershed file system.
|
||||
|
||||
Arguments:
|
||||
CallbackData - BMM context data
|
||||
KeyValue - Key value to identify the type of data to expect.
|
||||
|
||||
Returns:
|
||||
TRUE - Inform the caller to create a callback packet to exit file explorer.
|
||||
FALSE - Indicate that there is no need to exit file explorer.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT16 FileOptionMask;
|
||||
BM_MENU_ENTRY *NewMenuEntry;
|
||||
BM_FILE_CONTEXT *NewFileContext;
|
||||
FORM_ID FormId;
|
||||
BOOLEAN ExitFileExplorer;
|
||||
|
||||
NewMenuEntry = NULL;
|
||||
NewFileContext = NULL;
|
||||
ExitFileExplorer = FALSE;
|
||||
|
||||
FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue);
|
||||
|
||||
if (UNKNOWN_CONTEXT == CallbackData->FeDisplayContext) {
|
||||
//
|
||||
// First in, display file system.
|
||||
//
|
||||
BOpt_FreeMenu (&FsOptionMenu);
|
||||
BOpt_FindFileSystem (CallbackData);
|
||||
CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);
|
||||
|
||||
UpdateFileExplorePage (CallbackData, &FsOptionMenu);
|
||||
|
||||
CallbackData->FeDisplayContext = FILE_SYSTEM;
|
||||
} else {
|
||||
if (FILE_SYSTEM == CallbackData->FeDisplayContext) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);
|
||||
} else if (DIRECTORY == CallbackData->FeDisplayContext) {
|
||||
NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);
|
||||
}
|
||||
|
||||
CallbackData->FeDisplayContext = DIRECTORY;
|
||||
|
||||
NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
|
||||
|
||||
if (NewFileContext->IsDir ) {
|
||||
RemoveEntryList (&NewMenuEntry->Link);
|
||||
BOpt_FreeMenu (&DirectoryMenu);
|
||||
BOpt_FindFiles (CallbackData, NewMenuEntry);
|
||||
CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &DirectoryMenu);
|
||||
BOpt_DestroyMenuEntry (NewMenuEntry);
|
||||
|
||||
UpdateFileExplorePage (CallbackData, &DirectoryMenu);
|
||||
|
||||
} else {
|
||||
switch (CallbackData->FeCurrentState) {
|
||||
case BOOT_FROM_FILE_STATE:
|
||||
//
|
||||
// Here boot from file
|
||||
//
|
||||
BootThisFile (NewFileContext);
|
||||
ExitFileExplorer = TRUE;
|
||||
break;
|
||||
|
||||
case ADD_BOOT_OPTION_STATE:
|
||||
case ADD_DRIVER_OPTION_STATE:
|
||||
if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
|
||||
FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
|
||||
} else {
|
||||
FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
|
||||
}
|
||||
|
||||
CallbackData->MenuEntry = NewMenuEntry;
|
||||
CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;
|
||||
|
||||
//
|
||||
// Clean up file explore page.
|
||||
//
|
||||
RefreshUpdateData (FALSE, 0, FALSE, 0, 1);
|
||||
|
||||
//
|
||||
// Remove the Subtitle op-code.
|
||||
//
|
||||
CallbackData->Hii->UpdateForm (
|
||||
CallbackData->Hii,
|
||||
CallbackData->FeHiiHandle,
|
||||
FormId,
|
||||
FALSE,
|
||||
UpdateData
|
||||
);
|
||||
|
||||
//
|
||||
// Create Subtitle op-code for the display string of the option.
|
||||
//
|
||||
RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 1);
|
||||
|
||||
CreateSubTitleOpCode (
|
||||
NewMenuEntry->DisplayStringToken,
|
||||
&UpdateData->Data
|
||||
);
|
||||
|
||||
CallbackData->Hii->UpdateForm (
|
||||
CallbackData->Hii,
|
||||
CallbackData->FeHiiHandle,
|
||||
FormId,
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ExitFileExplorer;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FileExplorerCallback (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *Data,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
Callback Function for file exploration and file interaction.
|
||||
|
||||
Arguments:
|
||||
This - File explorer callback protocol pointer.
|
||||
KeyValue - Key value to identify the type of data to expect.
|
||||
Data - A pointer to the data being sent to the original exporting driver.
|
||||
Packet - A pointer to a packet of information which a driver passes back to the browser.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Callback ended successfully.
|
||||
Others - Contain some errors.
|
||||
|
||||
--*/
|
||||
{
|
||||
BMM_CALLBACK_DATA *Private;
|
||||
FILE_EXPLORER_NV_DATA *NvRamMap;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Private = FE_CALLBACK_DATA_FROM_THIS (This);
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->FeCallbackHandle;
|
||||
NvRamMap = (FILE_EXPLORER_NV_DATA *) Data->NvRamMap;
|
||||
|
||||
if (KEY_VALUE_SAVE_AND_EXIT == KeyValue) {
|
||||
//
|
||||
// Apply changes and exit formset.
|
||||
//
|
||||
if (ADD_BOOT_OPTION_STATE == Private->FeCurrentState) {
|
||||
Status = Var_UpdateBootOption (Private, NvRamMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOpt_GetBootOptions (Private);
|
||||
CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
|
||||
} else if (ADD_DRIVER_OPTION_STATE == Private->FeCurrentState) {
|
||||
Status = Var_UpdateDriverOption (
|
||||
Private,
|
||||
Private->FeHiiHandle,
|
||||
NvRamMap->DescriptionData,
|
||||
NvRamMap->OptionalData,
|
||||
NvRamMap->ForceReconnect
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOpt_GetDriverOptions (Private);
|
||||
CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
|
||||
}
|
||||
|
||||
CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
|
||||
} else if (KEY_VALUE_NO_SAVE_AND_EXIT == KeyValue) {
|
||||
//
|
||||
// Discard changes and exit formset.
|
||||
//
|
||||
NvRamMap->OptionalData[0] = 0x0000;
|
||||
NvRamMap->DescriptionData[0] = 0x0000;
|
||||
CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
|
||||
} else if (KeyValue < FILE_OPTION_OFFSET) {
|
||||
//
|
||||
// Exit File Explorer formset.
|
||||
//
|
||||
CreateCallbackPacket (Packet, EXIT_REQUIRED);
|
||||
} else {
|
||||
if (UpdateFileExplorer (Private, KeyValue)) {
|
||||
CreateCallbackPacket (Packet, EXIT_REQUIRED);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
32
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FormGuid.h
Normal file
32
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/FormGuid.h
Normal file
@@ -0,0 +1,32 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// formguid.h
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Formset guids for Boot Maintenance Manager
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
//
|
||||
#define MAIN_FORMSET_GUID \
|
||||
{ \
|
||||
0x642237c7, 0x35d4, 0x472d, { 0x83, 0x65, 0x12, 0xe0, 0xcc, 0xf2, 0x7a, 0x22 } \
|
||||
}
|
||||
|
||||
#define FILE_EXPLORE_FORMSET_GUID \
|
||||
{ \
|
||||
0x1f2d63e1, 0xfebd, 0x4dc7, { 0x9c, 0xc5, 0xba, 0x2b, 0x1c, 0xef, 0x9c, 0x5b } \
|
||||
}
|
1275
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c
Normal file
1275
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/UpdatePage.c
Normal file
File diff suppressed because it is too large
Load Diff
1279
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Variable.c
Normal file
1279
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/Variable.c
Normal file
File diff suppressed because it is too large
Load Diff
495
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bm.vfr
Normal file
495
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bm.vfr
Normal file
@@ -0,0 +1,495 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// bm.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Boot Maintenance Utility Formset
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "BdsStrDefs.h"
|
||||
#include "formguid.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
//
|
||||
// This is the structure that will be used to store the
|
||||
// question's current value. Use it at initialize time to
|
||||
// set default value for each question. When using at run
|
||||
// time, this map is returned by the callback function,
|
||||
// so dynamically changing the question's value will be
|
||||
// possible through this mechanism
|
||||
//
|
||||
typedef struct {
|
||||
|
||||
//
|
||||
// Three questions displayed at the main page
|
||||
// for Timeout, BootNext Variables respectively
|
||||
//
|
||||
UINT16 BootTimeOut;
|
||||
UINT16 BootNext;
|
||||
|
||||
//
|
||||
// This is the COM1 Attributes value storage
|
||||
//
|
||||
UINT8 COM1BaudRate;
|
||||
UINT8 COM1DataRate;
|
||||
UINT8 COM1StopBits;
|
||||
UINT8 COM1Parity;
|
||||
UINT8 COM1TerminalType;
|
||||
|
||||
//
|
||||
// This is the COM2 Attributes value storage
|
||||
//
|
||||
UINT8 COM2BaudRate;
|
||||
UINT8 COM2DataRate;
|
||||
UINT8 COM2StopBits;
|
||||
UINT8 COM2Parity;
|
||||
UINT8 COM2TerminalType;
|
||||
|
||||
//
|
||||
// Driver Option Add Handle page storage
|
||||
//
|
||||
UINT16 DriverAddHandleDesc[100];
|
||||
UINT16 DriverAddHandleOptionalData[100];
|
||||
UINT8 DriverAddActive;
|
||||
UINT8 DriverAddForceReconnect;
|
||||
|
||||
//
|
||||
// Console Input/Output/Errorout using COM port check storage
|
||||
//
|
||||
UINT8 ConsoleInputCOM1;
|
||||
UINT8 ConsoleInputCOM2;
|
||||
UINT8 ConsoleOutputCOM1;
|
||||
UINT8 ConsoleOutputCOM2;
|
||||
UINT8 ConsoleErrorCOM1;
|
||||
UINT8 ConsoleErrorCOM2;
|
||||
|
||||
//
|
||||
// At most 100 input/output/errorout device for console storage
|
||||
//
|
||||
UINT8 ConsoleCheck[100];
|
||||
|
||||
//
|
||||
// Boot or Driver Option Order storage
|
||||
//
|
||||
UINT8 OptionOrder[100];
|
||||
UINT8 DriverOptionToBeDeleted[100];
|
||||
|
||||
//
|
||||
// Boot Option Delete storage
|
||||
//
|
||||
UINT8 BootOptionDel[100];
|
||||
UINT8 DriverOptionDel[100];
|
||||
|
||||
//
|
||||
// This is the Terminal Attributes value storage
|
||||
//
|
||||
UINT8 COMBaudRate;
|
||||
UINT8 COMDataRate;
|
||||
UINT8 COMStopBits;
|
||||
UINT8 COMParity;
|
||||
UINT8 COMTerminalType;
|
||||
|
||||
//
|
||||
// Legacy Device Order Selection Storage
|
||||
//
|
||||
UINT8 LegacyFD[100];
|
||||
UINT8 LegacyHD[100];
|
||||
UINT8 LegacyCD[100];
|
||||
UINT8 LegacyNET[100];
|
||||
UINT8 LegacyBEV[100];
|
||||
} BMM_FAKE_NV_DATA;
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#define FORM_MAIN_ID 0x0001
|
||||
#define FORM_BOOT_ADD_ID 0x0002
|
||||
#define FORM_BOOT_DEL_ID 0x0003
|
||||
#define FORM_BOOT_CHG_ID 0x0004
|
||||
#define FORM_DRV_ADD_ID 0x0005
|
||||
#define FORM_DRV_DEL_ID 0x0006
|
||||
#define FORM_DRV_CHG_ID 0x0007
|
||||
#define FORM_CON_MAIN_ID 0x0008
|
||||
#define FORM_CON_IN_ID 0x0009
|
||||
#define FORM_CON_OUT_ID 0x000A
|
||||
#define FORM_CON_ERR_ID 0x000B
|
||||
#define FORM_FILE_SEEK_ID 0x000C
|
||||
#define FORM_FILE_NEW_SEEK_ID 0x000D
|
||||
#define FORM_DRV_ADD_FILE_ID 0x000E
|
||||
#define FORM_DRV_ADD_HANDLE_ID 0x000F
|
||||
#define FORM_DRV_ADD_HANDLE_DESC_ID 0x0010
|
||||
#define FORM_BOOT_NEXT_ID 0x0011
|
||||
#define FORM_TIME_OUT_ID 0x0012
|
||||
#define FORM_RESET 0x0013
|
||||
#define FORM_BOOT_SETUP_ID 0x0014
|
||||
#define FORM_DRIVER_SETUP_ID 0x0015
|
||||
#define FORM_BOOT_LEGACY_DEVICE_ID 0x0016
|
||||
#define FORM_CON_COM_ID 0x0017
|
||||
#define FORM_CON_COM_SETUP_ID 0x0018
|
||||
#define FORM_SET_FD_ORDER_ID 0x0019
|
||||
#define FORM_SET_HD_ORDER_ID 0x001A
|
||||
#define FORM_SET_CD_ORDER_ID 0x001B
|
||||
#define FORM_SET_NET_ORDER_ID 0x001C
|
||||
#define FORM_SET_BEV_ORDER_ID 0x001D
|
||||
|
||||
#define KEY_VALUE_BOOT_FROM_FILE 0x0092
|
||||
|
||||
formset
|
||||
guid = MAIN_FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FORM_MAIN_TITLE), // uint8 opcode, uint8 length, guid Handle, uint16 Title
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = 0,
|
||||
subclass = 0,
|
||||
|
||||
form formid = FORM_MAIN_ID,
|
||||
title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
|
||||
|
||||
goto FORM_BOOT_SETUP_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_BOOT_SETUP_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
goto FORM_DRIVER_SETUP_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_DRIVER_SETUP_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
goto FORM_CON_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_CON_MAIN_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
|
||||
text = STRING_TOKEN(STR_BOOT_FROM_FILE),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = KEY_VALUE_BOOT_FROM_FILE;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
// label FORM_MAIN_ID;
|
||||
|
||||
goto FORM_BOOT_NEXT_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_BOOT_NEXT_ID;
|
||||
|
||||
goto FORM_TIME_OUT_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_TIME_OUT_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_RESET),
|
||||
help = STRING_TOKEN(STR_RESET),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_RESET;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_SETUP_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_MAIN_ID;
|
||||
|
||||
goto FORM_BOOT_ADD_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_BOOT_ADD_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_BOOT_ADD_ID;
|
||||
|
||||
goto FORM_BOOT_DEL_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_BOOT_DEL_ID;
|
||||
|
||||
goto FORM_BOOT_CHG_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_BOOT_CHG_ID;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
//
|
||||
// We will add "Select Legacy Boot Floppy Drive" and "Select Legacy Boot Hard Drive"
|
||||
// here dynamically
|
||||
//
|
||||
label FORM_BOOT_LEGACY_DEVICE_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRIVER_SETUP_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_MAIN_ID;
|
||||
|
||||
goto FORM_DRV_ADD_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_DRV_ADD_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_DRV_ADD_ID;
|
||||
|
||||
goto FORM_DRV_DEL_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_DRV_DEL_ID;
|
||||
|
||||
goto FORM_DRV_CHG_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_DRV_CHG_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_ADD_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
|
||||
|
||||
label FORM_BOOT_ADD_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_DEL_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);
|
||||
|
||||
label FORM_BOOT_DEL_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_CHG_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
|
||||
|
||||
label FORM_BOOT_CHG_ID;
|
||||
|
||||
//
|
||||
// This tag is added for bypassing issue of setup browser
|
||||
// setup browser could not support dynamic form very well.
|
||||
//
|
||||
checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
|
||||
prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
|
||||
flags = 1,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_BOOT_NEXT_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);
|
||||
|
||||
label FORM_BOOT_NEXT_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_TIME_OUT_ID,
|
||||
title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);
|
||||
|
||||
label FORM_TIME_OUT_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_ADD_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_MAIN_ID;
|
||||
|
||||
goto FORM_DRV_ADD_FILE_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_DRV_ADD_FILE_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_DEL_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE);
|
||||
|
||||
label FORM_DRV_DEL_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_CHG_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE);
|
||||
|
||||
label FORM_DRV_CHG_ID;
|
||||
|
||||
//
|
||||
// This tag is added for bypassing issue of setup browser
|
||||
// setup browser could not support dynamic form very well.
|
||||
//
|
||||
checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
|
||||
prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
|
||||
flags = 1,
|
||||
key = 0,
|
||||
endcheckbox;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_MAIN_ID,
|
||||
title = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE);
|
||||
|
||||
goto FORM_MAIN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_MAIN_ID;
|
||||
|
||||
goto FORM_CON_IN_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_CON_IN_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_CON_IN_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_CON_IN_ID;
|
||||
|
||||
goto FORM_CON_OUT_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_CON_OUT_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_CON_OUT_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_CON_OUT_ID;
|
||||
|
||||
goto FORM_CON_ERR_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_STD_ERR_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_STD_ERR_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_CON_ERR_ID;
|
||||
|
||||
goto FORM_CON_COM_ID,
|
||||
prompt = STRING_TOKEN(STR_FORM_COM_TITLE),
|
||||
help = STRING_TOKEN(STR_FORM_COM_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = FORM_CON_COM_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_COM_ID,
|
||||
title = STRING_TOKEN(STR_FORM_COM_TITLE);
|
||||
|
||||
label FORM_CON_COM_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_COM_SETUP_ID,
|
||||
title = STRING_TOKEN(STR_CON_COM_SETUP);
|
||||
|
||||
label FORM_CON_COM_SETUP_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_FILE_SEEK_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
|
||||
|
||||
label FORM_FILE_SEEK_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_FILE_NEW_SEEK_ID,
|
||||
title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
|
||||
|
||||
label FORM_FILE_NEW_SEEK_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_ADD_FILE_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);
|
||||
|
||||
label FORM_DRV_ADD_FILE_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_ADD_HANDLE_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);
|
||||
|
||||
label FORM_DRV_ADD_HANDLE_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_DRV_ADD_HANDLE_DESC_ID,
|
||||
title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
|
||||
|
||||
label FORM_DRV_ADD_HANDLE_DESC_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_IN_ID,
|
||||
title = STRING_TOKEN(STR_FORM_CON_IN_TITLE);
|
||||
|
||||
label FORM_CON_IN_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_OUT_ID,
|
||||
title = STRING_TOKEN(STR_FORM_CON_OUT_TITLE);
|
||||
|
||||
label FORM_CON_OUT_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_CON_ERR_ID,
|
||||
title = STRING_TOKEN(STR_FORM_STD_ERR_TITLE);
|
||||
|
||||
label FORM_CON_ERR_ID;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_SET_FD_ORDER_ID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_FD_ORDER_TITLE);
|
||||
|
||||
label FORM_SET_FD_ORDER_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_SET_HD_ORDER_ID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_HD_ORDER_TITLE);
|
||||
|
||||
label FORM_SET_HD_ORDER_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_SET_CD_ORDER_ID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_CD_ORDER_TITLE);
|
||||
|
||||
label FORM_SET_CD_ORDER_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_SET_NET_ORDER_ID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_NET_ORDER_TITLE);
|
||||
|
||||
label FORM_SET_NET_ORDER_ID;
|
||||
endform;
|
||||
|
||||
form formid = FORM_SET_BEV_ORDER_ID,
|
||||
title = STRING_TOKEN(STR_FORM_SET_BEV_ORDER_TITLE);
|
||||
|
||||
label FORM_SET_BEV_ORDER_ID;
|
||||
endform;
|
||||
|
||||
endformset;
|
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bmstring.uni
Normal file
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMaint/bmstring.uni
Normal file
Binary file not shown.
333
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c
Normal file
333
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.c
Normal file
@@ -0,0 +1,333 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BootManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform boot manager reference implement
|
||||
|
||||
--*/
|
||||
#include "BootManager.h"
|
||||
|
||||
UINT16 mKeyInput;
|
||||
LIST_ENTRY *mBootOptionsList;
|
||||
BDS_COMMON_OPTION *gOption;
|
||||
EFI_HII_HANDLE gBootManagerHandle;
|
||||
EFI_HANDLE BootManagerCallbackHandle;
|
||||
EFI_FORM_CALLBACK_PROTOCOL BootManagerCallback;
|
||||
EFI_GUID gBmGuid = BOOT_MANAGER_GUID;
|
||||
|
||||
extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
|
||||
extern UINT8 BootManagerVfrBin[];
|
||||
extern UINT8 BdsStrings[];
|
||||
extern BOOLEAN gConnectAllHappened;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BootManagerCallbackRoutine (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *DataArray,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the function that is called to provide results data to the driver. This data
|
||||
consists of a unique key which is used to identify what data is either being passed back
|
||||
or being asked for.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyValue - A unique value which is sent to the original exporting driver so that it
|
||||
can identify the type of data to expect. The format of the data tends to
|
||||
vary based on the op-code that geerated the callback.
|
||||
|
||||
Data - A pointer to the data being sent to the original exporting driver.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
BDS_COMMON_OPTION *Option;
|
||||
LIST_ENTRY *Link;
|
||||
UINT16 KeyCount;
|
||||
EFI_HII_CALLBACK_PACKET *DataPacket;
|
||||
|
||||
//
|
||||
// Initialize the key count
|
||||
//
|
||||
KeyCount = 0;
|
||||
|
||||
for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {
|
||||
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
||||
|
||||
KeyCount++;
|
||||
|
||||
gOption = Option;
|
||||
|
||||
//
|
||||
// Is this device the one chosen?
|
||||
//
|
||||
if (KeyCount == KeyValue) {
|
||||
//
|
||||
// Assigning the returned Key to a global allows the original routine to know what was chosen
|
||||
//
|
||||
mKeyInput = KeyValue;
|
||||
|
||||
*Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
|
||||
ASSERT (*Packet != NULL);
|
||||
|
||||
//
|
||||
// Assign the buffer address to DataPacket
|
||||
//
|
||||
DataPacket = *Packet;
|
||||
|
||||
DataPacket->DataArray.EntryCount = 1;
|
||||
DataPacket->DataArray.NvRamMap = NULL;
|
||||
((EFI_IFR_DATA_ENTRY *) (((EFI_IFR_DATA_ARRAY *)DataPacket) + 1))->Flags = EXIT_REQUIRED | NV_NOT_CHANGED;
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
CallBootManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Hook to enable UI timeout override behavior.
|
||||
|
||||
Arguments:
|
||||
BdsDeviceList - Device List that BDS needs to connect.
|
||||
|
||||
Entry - Pointer to current Boot Entry.
|
||||
|
||||
Returns:
|
||||
NONE
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
BDS_COMMON_OPTION *Option;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
CHAR16 *ExitData;
|
||||
UINTN ExitDataSize;
|
||||
STRING_REF Token;
|
||||
STRING_REF LastToken;
|
||||
EFI_INPUT_KEY Key;
|
||||
UINT8 *Location;
|
||||
EFI_GUID BmGuid;
|
||||
LIST_ENTRY BdsBootOptionList;
|
||||
|
||||
gOption = NULL;
|
||||
InitializeListHead (&BdsBootOptionList);
|
||||
|
||||
//
|
||||
// Connect all prior to entering the platform setup menu.
|
||||
//
|
||||
if (!gConnectAllHappened) {
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
gConnectAllHappened = TRUE;
|
||||
}
|
||||
//
|
||||
// BugBug: Here we can not remove the legacy refresh macro, so we need
|
||||
// get the boot order every time from "BootOrder" variable.
|
||||
// Recreate the boot option list base on the BootOrder variable
|
||||
//
|
||||
BdsLibEnumerateAllBootOption (&BdsBootOptionList);
|
||||
|
||||
//
|
||||
// This GUID must be the same as what is defined in BootManagerVfr.vfr
|
||||
//
|
||||
BmGuid = gBmGuid;
|
||||
|
||||
mBootOptionsList = &BdsBootOptionList;
|
||||
|
||||
//
|
||||
// Post our VFR to the HII database
|
||||
//
|
||||
PackageList = PreparePackages (2, &BmGuid, BootManagerVfrBin, BdsStrings);
|
||||
Status = Hii->NewPack (Hii, PackageList, &gBootManagerHandle);
|
||||
gBS->FreePool (PackageList);
|
||||
|
||||
//
|
||||
// This example does not implement worker functions
|
||||
// for the NV accessor functions. Only a callback evaluator
|
||||
//
|
||||
BootManagerCallback.NvRead = NULL;
|
||||
BootManagerCallback.NvWrite = NULL;
|
||||
BootManagerCallback.Callback = BootManagerCallbackRoutine;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
BootManagerCallbackHandle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&BootManagerCallbackHandle,
|
||||
&gEfiFormCallbackProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&BootManagerCallback
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
LastToken = 0;
|
||||
Hii->NewString (Hii, NULL, gBootManagerHandle, &LastToken, L" ");
|
||||
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
//
|
||||
// Flag update pending in FormSet
|
||||
//
|
||||
UpdateData->FormSetUpdate = TRUE;
|
||||
//
|
||||
// Register CallbackHandle data for FormSet
|
||||
//
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) BootManagerCallbackHandle;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
//
|
||||
// Create blank space. Since when we update the contents of IFR data at a label, it is
|
||||
// inserted at the location of the label. So if you want to add a string with an empty
|
||||
// space afterwards, you need to add the space first and then the string like below.
|
||||
//
|
||||
Status = CreateSubTitleOpCode (
|
||||
LastToken, // Token Value for the string
|
||||
&UpdateData->Data // Buffer containing created op-code
|
||||
);
|
||||
|
||||
Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
|
||||
|
||||
//
|
||||
// Create "Boot Option Menu" title
|
||||
//
|
||||
Status = CreateSubTitleOpCode (
|
||||
STRING_TOKEN (STR_BOOT_OPTION_BANNER), // Token Value for the string
|
||||
&UpdateData->Data // Buffer containing created op-code
|
||||
);
|
||||
|
||||
Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
|
||||
|
||||
Token = LastToken;
|
||||
mKeyInput = 0;
|
||||
|
||||
UpdateData->DataCount = 0;
|
||||
Location = (UINT8 *) &UpdateData->Data;
|
||||
|
||||
for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {
|
||||
Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
|
||||
|
||||
//
|
||||
// At this stage we are creating a menu entry, thus the Keys are reproduceable
|
||||
//
|
||||
mKeyInput++;
|
||||
Token++;
|
||||
|
||||
Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
|
||||
|
||||
//
|
||||
// If we got an error it is almost certainly due to the token value being invalid.
|
||||
// Therefore we will set the Token to 0 to automatically add a token.
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
Token = 0;
|
||||
Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
|
||||
}
|
||||
|
||||
Status = CreateGotoOpCode (
|
||||
0x1000, // Form ID
|
||||
Token, // Token Value for the string
|
||||
0, // Help String (none)
|
||||
EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // The Op-Code flags
|
||||
mKeyInput, // The Key to get a callback on
|
||||
Location // Buffer containing created op-code
|
||||
);
|
||||
|
||||
UpdateData->DataCount++;
|
||||
Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
|
||||
|
||||
}
|
||||
|
||||
Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0001, TRUE, UpdateData);
|
||||
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
//
|
||||
// Create "Boot Option Menu" title
|
||||
//
|
||||
Status = CreateSubTitleOpCode (
|
||||
STRING_TOKEN (STR_HELP_FOOTER), // Token Value for the string
|
||||
&UpdateData->Data // Buffer containing created op-code
|
||||
);
|
||||
|
||||
Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
|
||||
|
||||
Status = CreateSubTitleOpCode (
|
||||
LastToken, // Token Value for the string
|
||||
&UpdateData->Data // Buffer containing created op-code
|
||||
);
|
||||
|
||||
Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
|
||||
|
||||
gBS->FreePool (UpdateData);
|
||||
|
||||
ASSERT (gBrowser);
|
||||
|
||||
gBrowser->SendForm (gBrowser, TRUE, &gBootManagerHandle, 1, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
Hii->ResetStrings (Hii, gBootManagerHandle);
|
||||
|
||||
if (gOption == NULL) {
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// BugBug: This code looks repeated from the BDS. Need to save code space.
|
||||
//
|
||||
|
||||
//
|
||||
// parse the selected option
|
||||
//
|
||||
Status = BdsLibBootViaBootOption (gOption, gOption->DevicePath, &ExitDataSize, &ExitData);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PlatformBdsBootSuccess (gOption);
|
||||
} else {
|
||||
PlatformBdsBootFail (gOption, Status, ExitData, ExitDataSize);
|
||||
gST->ConOut->OutputString (
|
||||
gST->ConOut,
|
||||
GetStringById (STRING_TOKEN (STR_ANY_KEY_CONTINUE))
|
||||
);
|
||||
|
||||
//
|
||||
// BdsLibUiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
|
||||
//
|
||||
|
||||
gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
}
|
||||
}
|
50
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.h
Normal file
50
EdkNt32Pkg/Dxe/PlatformBds/Generic/BootMngr/BootManager.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
BootManager.h
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform boot manager reference implement
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_BOOT_MANAGER_H
|
||||
#define _EFI_BOOT_MANAGER_H
|
||||
|
||||
#include "Generic/Bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
#include "Generic/String.h"
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BootManagerCallbackRoutine (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *DataArray,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
);
|
||||
|
||||
VOID
|
||||
CallBootManager (
|
||||
VOID
|
||||
);
|
||||
|
||||
#define BOOT_MANAGER_GUID \
|
||||
{ \
|
||||
0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } \
|
||||
}
|
||||
|
||||
#endif
|
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// BootManager.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Browser formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "BdsStrDefs.h"
|
||||
|
||||
#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, { 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } }
|
||||
|
||||
#define BOOT_MANAGER_HEADER 0x00
|
||||
#define BOOT_MANAGER_LABEL 0x01
|
||||
#define BOOT_MANAGER_TAIL 0x02
|
||||
|
||||
|
||||
#define BOOT_MANAGER_CLASS 0x00
|
||||
#define BOOT_MANAGER_SUBCLASS 0x01
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_BM_BANNER),
|
||||
help = STRING_TOKEN(STR_LAST_STRING),
|
||||
class = BOOT_MANAGER_CLASS,
|
||||
subclass = BOOT_MANAGER_SUBCLASS,
|
||||
|
||||
form formid = 0x1000,
|
||||
title = STRING_TOKEN(STR_BM_BANNER);
|
||||
|
||||
label BOOT_MANAGER_HEADER;
|
||||
label BOOT_MANAGER_LABEL;
|
||||
//
|
||||
// This is where we will dynamically add choices for the Boot Manager
|
||||
//
|
||||
|
||||
label BOOT_MANAGER_TAIL;
|
||||
endform;
|
||||
|
||||
endformset;
|
213
EdkNt32Pkg/Dxe/PlatformBds/Generic/Capsules.c
Normal file
213
EdkNt32Pkg/Dxe/PlatformBds/Generic/Capsules.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
Capsules.c
|
||||
|
||||
Abstract:
|
||||
|
||||
BDS routines to handle capsules.
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#include <Common/FlashMap.H>
|
||||
|
||||
VOID
|
||||
BdsLockFv (
|
||||
IN EFI_CPU_IO_PROTOCOL *CpuIo,
|
||||
IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
|
||||
);
|
||||
|
||||
VOID
|
||||
BdsLockFv (
|
||||
IN EFI_CPU_IO_PROTOCOL *CpuIo,
|
||||
IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
|
||||
)
|
||||
{
|
||||
EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
||||
UINT64 BaseAddress;
|
||||
UINT8 Data;
|
||||
UINT32 BlockLength;
|
||||
UINTN Index;
|
||||
|
||||
BaseAddress = FlashEntry->Base - 0x400000 + 2;
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) (FlashEntry->Base));
|
||||
BlockMap = &(FvHeader->FvBlockMap[0]);
|
||||
|
||||
while ((BlockMap->NumBlocks != 0) && (BlockMap->BlockLength != 0)) {
|
||||
BlockLength = BlockMap->BlockLength;
|
||||
for (Index = 0; Index < BlockMap->NumBlocks; Index++) {
|
||||
CpuIo->Mem.Read (
|
||||
CpuIo,
|
||||
EfiCpuIoWidthUint8,
|
||||
BaseAddress,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
Data = (UINT8) (Data | 0x3);
|
||||
CpuIo->Mem.Write (
|
||||
CpuIo,
|
||||
EfiCpuIoWidthUint8,
|
||||
BaseAddress,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
BaseAddress += BlockLength;
|
||||
}
|
||||
|
||||
BlockMap++;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
BdsLockNonUpdatableFlash (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntryData;
|
||||
EFI_PEI_HOB_POINTERS GuidHob;
|
||||
EFI_STATUS Status;
|
||||
EFI_CPU_IO_PROTOCOL *CpuIo;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &CpuIo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
GuidHob.Raw = GetHobList ();
|
||||
while ((GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw)) != NULL) {
|
||||
FlashMapEntryData = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
|
||||
//
|
||||
// Get the variable store area
|
||||
//
|
||||
if ((FlashMapEntryData->AreaType == EFI_FLASH_AREA_RECOVERY_BIOS) ||
|
||||
(FlashMapEntryData->AreaType == EFI_FLASH_AREA_MAIN_BIOS)
|
||||
) {
|
||||
BdsLockFv (CpuIo, &(FlashMapEntryData->Entries[0]));
|
||||
}
|
||||
GuidHob.Raw = GET_NEXT_HOB (GuidHob);
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ProcessCapsules (
|
||||
EFI_BOOT_MODE BootMode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine is called to see if there are any capsules we need to process.
|
||||
If the boot mode is not UPDATE, then we do nothing. Otherwise find the
|
||||
capsule HOBS and produce firmware volumes for them via the DXE service.
|
||||
Then call the dispatcher to dispatch drivers from them. Finally, check
|
||||
the status of the updates.
|
||||
|
||||
Arguments:
|
||||
|
||||
BootMode - the current boot mode
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_INVALID_PARAMETER - boot mode is not correct for an update
|
||||
|
||||
Note:
|
||||
|
||||
This function should be called by BDS in case we need to do some
|
||||
sort of processing even if there is no capsule to process. We
|
||||
need to do this if an earlier update went awry and we need to
|
||||
clear the capsule variable so on the next reset PEI does not see it and
|
||||
think there is a capsule available.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HOB_CAPSULE_VOLUME *CvHob;
|
||||
EFI_PHYSICAL_ADDRESS BaseAddress;
|
||||
UINT64 Length;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
EFI_HANDLE FvProtocolHandle;
|
||||
|
||||
//
|
||||
// We don't do anything else if the boot mode is not flash-update
|
||||
//
|
||||
if (BootMode != BOOT_ON_FLASH_UPDATE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Only one capsule HOB allowed.
|
||||
//
|
||||
CvHob = GetFirstHob (EFI_HOB_TYPE_CV);
|
||||
if (CvHob == NULL) {
|
||||
//
|
||||
// We didn't find a hob, so had no errors.
|
||||
//
|
||||
BdsLockNonUpdatableFlash ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BaseAddress = CvHob->BaseAddress;
|
||||
Length = CvHob->Length;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// Now walk the capsule and call the core to process each
|
||||
// firmware volume in it.
|
||||
//
|
||||
while (Length != 0) {
|
||||
//
|
||||
// Point to the next firmware volume header, and then
|
||||
// call the DXE service to process it.
|
||||
//
|
||||
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
|
||||
if (FwVolHeader->FvLength > Length) {
|
||||
//
|
||||
// Notes: need to stuff this status somewhere so that the
|
||||
// error can be detected at OS runtime
|
||||
//
|
||||
Status = EFI_VOLUME_CORRUPTED;
|
||||
break;
|
||||
}
|
||||
|
||||
Status = gDS->ProcessFirmwareVolume (
|
||||
(VOID *) (UINTN) BaseAddress,
|
||||
(UINTN) FwVolHeader->FvLength,
|
||||
&FvProtocolHandle
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Call the dispatcher to dispatch any drivers from the produced firmware volume
|
||||
//
|
||||
gDS->Dispatch ();
|
||||
//
|
||||
// On to the next FV in the capsule
|
||||
//
|
||||
Length -= FwVolHeader->FvLength;
|
||||
BaseAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) BaseAddress + FwVolHeader->FvLength);
|
||||
//
|
||||
// Notes: when capsule spec is finalized, if the requirement is made to
|
||||
// have each FV in a capsule aligned, then we will need to align the
|
||||
// BaseAddress and Length here.
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
BdsLockNonUpdatableFlash ();
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
482
EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c
Normal file
482
EdkNt32Pkg/Dxe/PlatformBds/Generic/DeviceMngr/DeviceManager.c
Normal file
@@ -0,0 +1,482 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
DeviceManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform device manager reference implement
|
||||
|
||||
--*/
|
||||
#include "DeviceManager.h"
|
||||
|
||||
STATIC UINT16 mTokenCount;
|
||||
EFI_FRONTPAGE_CALLBACK_INFO FPCallbackInfo;
|
||||
extern UINTN gCallbackKey;
|
||||
extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
|
||||
extern EFI_GUID gBdsStringPackGuid;
|
||||
extern BOOLEAN gConnectAllHappened;
|
||||
|
||||
STRING_REF gStringTokenTable[] = {
|
||||
STR_VIDEO_DEVICE,
|
||||
STR_NETWORK_DEVICE,
|
||||
STR_INPUT_DEVICE,
|
||||
STR_ON_BOARD_DEVICE,
|
||||
STR_OTHER_DEVICE,
|
||||
STR_EMPTY_STRING,
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DeviceManagerCallbackRoutine (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *DataArray,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the function that is called to provide results data to the driver. This data
|
||||
consists of a unique key which is used to identify what data is either being passed back
|
||||
or being asked for.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyValue - A unique value which is sent to the original exporting driver so that it
|
||||
can identify the type of data to expect. The format of the data tends to
|
||||
vary based on the op-code that geerated the callback.
|
||||
|
||||
Data - A pointer to the data being sent to the original exporting driver.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
//
|
||||
// The KeyValue corresponds in this case to the handle which was requested to be displayed
|
||||
//
|
||||
EFI_FRONTPAGE_CALLBACK_INFO *CallbackInfo;
|
||||
|
||||
CallbackInfo = EFI_FP_CALLBACK_DATA_FROM_THIS (This);
|
||||
switch (KeyValue) {
|
||||
case 0x2000:
|
||||
CallbackInfo->Data.VideoBIOS = (UINT8) (UINTN) (((EFI_IFR_DATA_ENTRY *)(DataArray + 1))->Data);
|
||||
gRT->SetVariable (
|
||||
L"VBIOS",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT8),
|
||||
&CallbackInfo->Data.VideoBIOS
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gCallbackKey = KeyValue;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeDeviceManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize HII information for the FrontPage
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
PackageList = PreparePackages (1, &gBdsStringPackGuid, DeviceManagerVfrBin);
|
||||
Status = Hii->NewPack (Hii, PackageList, &FPCallbackInfo.DevMgrHiiHandle);
|
||||
gBS->FreePool (PackageList);
|
||||
|
||||
//
|
||||
// This example does not implement worker functions for the NV accessor functions. Only a callback evaluator
|
||||
//
|
||||
FPCallbackInfo.Signature = EFI_FP_CALLBACK_DATA_SIGNATURE;
|
||||
FPCallbackInfo.DevMgrCallback.NvRead = NULL;
|
||||
FPCallbackInfo.DevMgrCallback.NvWrite = NULL;
|
||||
FPCallbackInfo.DevMgrCallback.Callback = DeviceManagerCallbackRoutine;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
FPCallbackInfo.CallbackHandle = NULL;
|
||||
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&FPCallbackInfo.CallbackHandle,
|
||||
&gEfiFormCallbackProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&FPCallbackInfo.DevMgrCallback
|
||||
);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Flag update pending in FormSet
|
||||
//
|
||||
UpdateData->FormSetUpdate = TRUE;
|
||||
//
|
||||
// Register CallbackHandle data for FormSet
|
||||
//
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FPCallbackInfo.CallbackHandle;
|
||||
//
|
||||
// Simply registering the callback handle
|
||||
//
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
|
||||
|
||||
gBS->FreePool (UpdateData);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CallDeviceManager (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Call the browser and display the device manager
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Operation is successful.
|
||||
EFI_INVALID_PARAMETER - If the inputs to SendForm function is not valid.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
UINTN Count;
|
||||
EFI_HII_HANDLE Index;
|
||||
UINT8 *Buffer;
|
||||
EFI_IFR_FORM_SET *FormSetData;
|
||||
CHAR16 *String;
|
||||
UINTN StringLength;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
STRING_REF Token;
|
||||
STRING_REF TokenHelp;
|
||||
IFR_OPTION *IfrOptionList;
|
||||
UINT8 *VideoOption;
|
||||
UINTN VideoOptionSize;
|
||||
EFI_HII_HANDLE *HiiHandles;
|
||||
UINT16 HandleBufferLength;
|
||||
|
||||
IfrOptionList = NULL;
|
||||
VideoOption = NULL;
|
||||
HandleBufferLength = 0;
|
||||
|
||||
//
|
||||
// Connect all prior to entering the platform setup menu.
|
||||
//
|
||||
if (!gConnectAllHappened) {
|
||||
BdsLibConnectAllDriversToAllControllers ();
|
||||
gConnectAllHappened = TRUE;
|
||||
}
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Buffer = NULL;
|
||||
FormSetData = NULL;
|
||||
gCallbackKey = 0;
|
||||
if (mTokenCount == 0) {
|
||||
Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &mTokenCount, L" ");
|
||||
}
|
||||
|
||||
Token = mTokenCount;
|
||||
TokenHelp = (UINT16) (Token + 1);
|
||||
|
||||
//
|
||||
// Reset the menu
|
||||
//
|
||||
for (Index = 0, Count = 1; Count < 0x10000; Count <<= 1, Index++) {
|
||||
//
|
||||
// We will strip off all previous menu entries
|
||||
//
|
||||
UpdateData->DataCount = 0xFF;
|
||||
|
||||
//
|
||||
// Erase entries on this label
|
||||
//
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, FALSE, UpdateData);
|
||||
|
||||
//
|
||||
// Did we reach the end of the Token Table?
|
||||
//
|
||||
if (gStringTokenTable[Index] == 0xFFFF) {
|
||||
break;
|
||||
}
|
||||
|
||||
CreateSubTitleOpCode (gStringTokenTable[Index], &UpdateData->Data);
|
||||
//
|
||||
// Add a single menu item - in this case a subtitle for the device type
|
||||
//
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
//
|
||||
// Add default title for this label
|
||||
//
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
|
||||
}
|
||||
//
|
||||
// Add a space and an exit string. Remember since we add things at the label and push other things beyond the
|
||||
// label down, we add this in reverse order
|
||||
//
|
||||
CreateSubTitleOpCode (STRING_TOKEN (STR_EXIT_STRING), &UpdateData->Data);
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
|
||||
CreateSubTitleOpCode (STR_EMPTY_STRING, &UpdateData->Data);
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
|
||||
|
||||
HiiHandles = AllocateZeroPool (HandleBufferLength);
|
||||
Hii->FindHandles (Hii, &HandleBufferLength, HiiHandles);
|
||||
|
||||
for (Index = 1, BufferSize = 0; Index < HandleBufferLength; Index++) {
|
||||
//
|
||||
// Am not initializing Buffer since the first thing checked is the size
|
||||
// this way I can get the real buffersize in the smallest code size
|
||||
//
|
||||
Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
|
||||
|
||||
if (Status != EFI_NOT_FOUND) {
|
||||
//
|
||||
// BufferSize should have the real size of the forms now
|
||||
//
|
||||
Buffer = AllocateZeroPool (BufferSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
//
|
||||
// Am not initializing Buffer since the first thing checked is the size
|
||||
// this way I can get the real buffersize in the smallest code size
|
||||
//
|
||||
Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
|
||||
|
||||
//
|
||||
// Skip EFI_HII_PACK_HEADER, advance to EFI_IFR_FORM_SET data.
|
||||
//
|
||||
FormSetData = (EFI_IFR_FORM_SET *) (Buffer + sizeof (EFI_HII_PACK_HEADER));
|
||||
|
||||
//
|
||||
// If this formset belongs in the device manager, add it to the menu
|
||||
//
|
||||
if (FormSetData->Class != EFI_NON_DEVICE_CLASS) {
|
||||
|
||||
StringLength = 0x1000;
|
||||
String = AllocateZeroPool (StringLength);
|
||||
ASSERT (String != NULL);
|
||||
|
||||
Status = Hii->GetString (Hii, Index, FormSetData->FormSetTitle, TRUE, NULL, &StringLength, String);
|
||||
Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
|
||||
|
||||
//
|
||||
// If token value exceeded real token value - we need to add a new token values
|
||||
//
|
||||
if (Status == EFI_INVALID_PARAMETER) {
|
||||
Token = 0;
|
||||
TokenHelp = 0;
|
||||
Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
|
||||
}
|
||||
|
||||
StringLength = 0x1000;
|
||||
if (FormSetData->Help == 0) {
|
||||
TokenHelp = 0;
|
||||
} else {
|
||||
Status = Hii->GetString (Hii, Index, FormSetData->Help, TRUE, NULL, &StringLength, String);
|
||||
if (StringLength == 0x02) {
|
||||
TokenHelp = 0;
|
||||
} else {
|
||||
Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
|
||||
if (Status == EFI_INVALID_PARAMETER) {
|
||||
TokenHelp = 0;
|
||||
Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (String);
|
||||
|
||||
CreateGotoOpCode (
|
||||
0x1000, // Device Manager Page
|
||||
Token, // Description String Token
|
||||
TokenHelp, // Description Help String Token
|
||||
EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // Flag designating callback is active
|
||||
(UINT16) Index, // Callback key value
|
||||
&UpdateData->Data // Buffer to fill with op-code
|
||||
);
|
||||
|
||||
//
|
||||
// In the off-chance that we have lots of extra tokens allocated to the DeviceManager
|
||||
// this ensures we are fairly re-using the tokens instead of constantly growing the token
|
||||
// storage for this one handle. If we incremented the token value beyond what it normally
|
||||
// would use, we will fall back into the error path which seeds the token value with a 0
|
||||
// so that we can correctly add a token value.
|
||||
//
|
||||
if (TokenHelp == 0) {
|
||||
//
|
||||
// Since we didn't add help, only advance Token by 1
|
||||
//
|
||||
Token++;
|
||||
} else {
|
||||
Token = (UINT16) (Token + 2);
|
||||
TokenHelp = (UINT16) (TokenHelp + 2);
|
||||
}
|
||||
//
|
||||
// This for loop basically will take the Class value which is a bitmask and
|
||||
// update the form for every active bit. There will be a label at each bit
|
||||
// location. So if someone had a device which a class of EFI_DISK_DEVICE_CLASS |
|
||||
// EFI_ON_BOARD_DEVICE_CLASS, this routine will unwind that mask and drop the menu entry
|
||||
// on each corresponding label.
|
||||
//
|
||||
for (Count = 1; Count < 0x10000; Count <<= 1) {
|
||||
//
|
||||
// This is an active bit, so update the form
|
||||
//
|
||||
if (FormSetData->Class & Count) {
|
||||
Hii->UpdateForm (
|
||||
Hii,
|
||||
FPCallbackInfo.DevMgrHiiHandle,
|
||||
(EFI_FORM_LABEL) (FormSetData->Class & Count),
|
||||
TRUE,
|
||||
UpdateData
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BufferSize = 0;
|
||||
//
|
||||
// Reset Buffer pointer to original location
|
||||
//
|
||||
gBS->FreePool (Buffer);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Add oneof for video BIOS selection
|
||||
//
|
||||
VideoOption = BdsLibGetVariableAndSize (
|
||||
L"VBIOS",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&VideoOptionSize
|
||||
);
|
||||
if (NULL == VideoOption) {
|
||||
FPCallbackInfo.Data.VideoBIOS = 0;
|
||||
} else {
|
||||
FPCallbackInfo.Data.VideoBIOS = VideoOption[0];
|
||||
gBS->FreePool (VideoOption);
|
||||
}
|
||||
|
||||
ASSERT (FPCallbackInfo.Data.VideoBIOS <= 1);
|
||||
|
||||
Status = gBS->AllocatePool (EfiBootServicesData, 2 * sizeof (IFR_OPTION), &IfrOptionList);
|
||||
if (IfrOptionList != NULL) {
|
||||
IfrOptionList[0].Flags = EFI_IFR_FLAG_INTERACTIVE;
|
||||
IfrOptionList[0].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
|
||||
IfrOptionList[0].StringToken = STRING_TOKEN (STR_ONE_OF_PCI);
|
||||
IfrOptionList[0].Value = 0;
|
||||
IfrOptionList[0].OptionString = NULL;
|
||||
IfrOptionList[1].Flags = EFI_IFR_FLAG_INTERACTIVE;
|
||||
IfrOptionList[1].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
|
||||
IfrOptionList[1].StringToken = STRING_TOKEN (STR_ONE_OF_AGP);
|
||||
IfrOptionList[1].Value = 1;
|
||||
IfrOptionList[1].OptionString = NULL;
|
||||
IfrOptionList[FPCallbackInfo.Data.VideoBIOS].Flags |= EFI_IFR_FLAG_DEFAULT;
|
||||
|
||||
CreateOneOfOpCode (
|
||||
SET_VIDEO_BIOS_TYPE_QUESTION_ID,
|
||||
(UINT8) 1,
|
||||
STRING_TOKEN (STR_ONE_OF_VBIOS),
|
||||
STRING_TOKEN (STR_ONE_OF_VBIOS_HELP),
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData->Data
|
||||
);
|
||||
|
||||
UpdateData->DataCount = 4;
|
||||
Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) EFI_VBIOS_CLASS, TRUE, UpdateData);
|
||||
gBS->FreePool (IfrOptionList);
|
||||
}
|
||||
|
||||
Status = gBrowser->SendForm (
|
||||
gBrowser,
|
||||
TRUE, // Use the database
|
||||
&FPCallbackInfo.DevMgrHiiHandle, // The HII Handle
|
||||
1,
|
||||
NULL,
|
||||
FPCallbackInfo.CallbackHandle,
|
||||
(UINT8 *) &FPCallbackInfo.Data,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);
|
||||
|
||||
//
|
||||
// We will have returned from processing a callback - user either hit ESC to exit, or selected
|
||||
// a target to display
|
||||
//
|
||||
if (gCallbackKey != 0 && gCallbackKey < 0x2000) {
|
||||
Status = gBrowser->SendForm (
|
||||
gBrowser,
|
||||
TRUE, // Use the database
|
||||
(EFI_HII_HANDLE *) &gCallbackKey, // The HII Handle
|
||||
1,
|
||||
NULL,
|
||||
NULL, // This is the handle that the interface to the callback was installed on
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Force return to Device Manager
|
||||
//
|
||||
gCallbackKey = 4;
|
||||
}
|
||||
|
||||
if (gCallbackKey >= 0x2000) {
|
||||
gCallbackKey = 4;
|
||||
}
|
||||
|
||||
gBS->FreePool (UpdateData);
|
||||
|
||||
return Status;
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
DeviceManager.c
|
||||
|
||||
Abstract:
|
||||
|
||||
The platform device manager reference implement
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _DEVICE_MANAGER_H
|
||||
#define _DEVICE_MANAGER_H
|
||||
|
||||
#include "Generic/FrontPage.h"
|
||||
|
||||
#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DeviceManagerCallbackRoutine (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *DataArray,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeDeviceManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CallDeviceManager (
|
||||
VOID
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
Binary file not shown.
@@ -0,0 +1,75 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// DeviceManagerVfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Device Manager formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "BdsStrDefs.h"
|
||||
|
||||
#define FORMSET_GUID { 0x3ebfa8e6, 0x511d, 0x4b5b, { 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 } }
|
||||
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
#define EFI_VBIOS_CLASS 0x40
|
||||
|
||||
#define DEVICE_MANAGER_CLASS 0x0000
|
||||
#define FRONT_PAGE_SUBCLASS 0x0003
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
|
||||
help = STRING_TOKEN(STR_EMPTY_STRING),
|
||||
class = DEVICE_MANAGER_CLASS,
|
||||
subclass = FRONT_PAGE_SUBCLASS,
|
||||
|
||||
form formid = 0x1000,
|
||||
title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
|
||||
|
||||
//
|
||||
// This is where devices get added to the device manager hierarchy
|
||||
//
|
||||
subtitle text = STRING_TOKEN(STR_DISK_DEVICE);
|
||||
label EFI_DISK_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_VIDEO_DEVICE);
|
||||
label EFI_VIDEO_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE);
|
||||
label EFI_NETWORK_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_INPUT_DEVICE);
|
||||
label EFI_INPUT_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_ON_BOARD_DEVICE);
|
||||
label EFI_ON_BOARD_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_OTHER_DEVICE);
|
||||
label EFI_OTHER_DEVICE_CLASS;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
|
||||
label EFI_VBIOS_CLASS;
|
||||
|
||||
endform;
|
||||
endformset;
|
||||
|
888
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
Normal file
888
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.c
Normal file
@@ -0,0 +1,888 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
FrontPage.c
|
||||
|
||||
Abstract:
|
||||
|
||||
FrontPage routines to handle the callbacks and browser calls
|
||||
|
||||
--*/
|
||||
|
||||
#include "Bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
#include "FrontPage.h"
|
||||
#include "String.h"
|
||||
|
||||
EFI_GUID mProcessorSubClass = EFI_PROCESSOR_SUBCLASS_GUID;
|
||||
EFI_GUID mMemorySubClass = EFI_MEMORY_SUBCLASS_GUID;
|
||||
EFI_GUID mMiscSubClass = EFI_MISC_SUBCLASS_GUID;
|
||||
|
||||
UINT16 mLastSelection;
|
||||
EFI_HII_HANDLE gFrontPageHandle;
|
||||
EFI_HANDLE FrontPageCallbackHandle;
|
||||
EFI_FORM_CALLBACK_PROTOCOL FrontPageCallback;
|
||||
EFI_FORM_BROWSER_PROTOCOL *gBrowser;
|
||||
UINTN gCallbackKey;
|
||||
BOOLEAN gConnectAllHappened = FALSE;
|
||||
|
||||
extern EFI_HII_HANDLE gFrontPageHandle;
|
||||
extern EFI_GUID gBdsStringPackGuid;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FrontPageCallbackRoutine (
|
||||
IN EFI_FORM_CALLBACK_PROTOCOL *This,
|
||||
IN UINT16 KeyValue,
|
||||
IN EFI_IFR_DATA_ARRAY *DataArray,
|
||||
OUT EFI_HII_CALLBACK_PACKET **Packet
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This is the function that is called to provide results data to the driver. This data
|
||||
consists of a unique key which is used to identify what data is either being passed back
|
||||
or being asked for.
|
||||
|
||||
Arguments:
|
||||
|
||||
KeyValue - A unique value which is sent to the original exporting driver so that it
|
||||
can identify the type of data to expect. The format of the data tends to
|
||||
vary based on the op-code that geerated the callback.
|
||||
|
||||
Data - A pointer to the data being sent to the original exporting driver.
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *LanguageString;
|
||||
UINTN Count;
|
||||
CHAR16 UnicodeLang[3];
|
||||
CHAR8 Lang[3];
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
CHAR16 *TmpStr;
|
||||
EFI_UGA_PIXEL Foreground;
|
||||
EFI_UGA_PIXEL Background;
|
||||
EFI_UGA_PIXEL Color;
|
||||
|
||||
SetMem (&Foreground, sizeof (EFI_UGA_PIXEL), 0xff);
|
||||
SetMem (&Background, sizeof (EFI_UGA_PIXEL), 0x0);
|
||||
SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0xff);
|
||||
|
||||
Count = 0;
|
||||
|
||||
//
|
||||
// The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
|
||||
// describe to their customers in documentation how to find their setup information (namely
|
||||
// under the device manager and specific buckets)
|
||||
//
|
||||
switch (KeyValue) {
|
||||
case 0x0001:
|
||||
//
|
||||
// This is the continue - clear the screen and return an error to get out of FrontPage loop
|
||||
//
|
||||
gCallbackKey = 1;
|
||||
break;
|
||||
|
||||
case 0x1234:
|
||||
//
|
||||
// Collect the languages from what our current Language support is based on our VFR
|
||||
//
|
||||
Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
|
||||
|
||||
//
|
||||
// Based on the DataArray->Data->Data value, we can determine
|
||||
// which language was chosen by the user
|
||||
//
|
||||
for (Index = 0; Count != (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray + 1))->Data); Index += 3) {
|
||||
Count++;
|
||||
}
|
||||
//
|
||||
// Preserve the choice the user made
|
||||
//
|
||||
mLastSelection = (UINT16) Count;
|
||||
|
||||
//
|
||||
// The Language (in Unicode format) the user chose
|
||||
//
|
||||
CopyMem (UnicodeLang, &LanguageString[Index], 6);
|
||||
|
||||
//
|
||||
// Convert Unicode to ASCII (Since the ISO standard assumes ASCII equivalent abbreviations
|
||||
// we can be safe in converting this Unicode stream to ASCII without any loss in meaning.
|
||||
//
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
Lang[Index] = (CHAR8) UnicodeLang[Index];
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
3,
|
||||
Lang
|
||||
);
|
||||
|
||||
gBS->FreePool (LanguageString);
|
||||
gCallbackKey = 2;
|
||||
break;
|
||||
|
||||
case 0x1064:
|
||||
//
|
||||
// Boot Manager
|
||||
//
|
||||
gCallbackKey = 3;
|
||||
break;
|
||||
|
||||
case 0x8567:
|
||||
//
|
||||
// Device Manager
|
||||
//
|
||||
gCallbackKey = 4;
|
||||
break;
|
||||
|
||||
case 0x9876:
|
||||
//
|
||||
// Boot Maintenance Manager
|
||||
//
|
||||
gCallbackKey = 5;
|
||||
break;
|
||||
|
||||
case 0xFFFE:
|
||||
|
||||
break;
|
||||
|
||||
case 0xFFFF:
|
||||
//
|
||||
// FrontPage TimeOut Callback
|
||||
//
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
|
||||
if (TmpStr != NULL) {
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
(UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray+1))->Data),
|
||||
0
|
||||
);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gCallbackKey = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeFrontPage (
|
||||
BOOLEAN ReInitializeStrings
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize HII information for the FrontPage
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The operation is successful.
|
||||
EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
IFR_OPTION *OptionList;
|
||||
CHAR16 *LanguageString;
|
||||
UINTN OptionCount;
|
||||
UINTN Index;
|
||||
STRING_REF Token;
|
||||
UINT16 Key;
|
||||
CHAR8 AsciiLang[4];
|
||||
CHAR16 UnicodeLang[4];
|
||||
CHAR16 Lang[4];
|
||||
CHAR16 *StringBuffer;
|
||||
UINTN BufferSize;
|
||||
UINT8 *TempBuffer;
|
||||
|
||||
UpdateData = NULL;
|
||||
OptionList = NULL;
|
||||
|
||||
if (ReInitializeStrings) {
|
||||
//
|
||||
// BugBug: Dont' use a goto
|
||||
//
|
||||
goto ReInitStrings;
|
||||
}
|
||||
//
|
||||
// Go ahead and initialize the Device Manager
|
||||
//
|
||||
InitializeDeviceManager ();
|
||||
|
||||
//
|
||||
// BugBug: if FrontPageVfrBin is generated by a tool, why are we patching it here
|
||||
//
|
||||
TempBuffer = (UINT8 *) FrontPageVfrBin;
|
||||
TempBuffer = TempBuffer + sizeof (EFI_HII_PACK_HEADER);
|
||||
TempBuffer = (UINT8 *) &((EFI_IFR_FORM_SET *) TempBuffer)->NvDataSize;
|
||||
*TempBuffer = 1;
|
||||
|
||||
gCallbackKey = 0;
|
||||
|
||||
PackageList = PreparePackages (1, &gBdsStringPackGuid, FrontPageVfrBin);
|
||||
|
||||
Status = Hii->NewPack (Hii, PackageList, &gFrontPageHandle);
|
||||
|
||||
gBS->FreePool (PackageList);
|
||||
|
||||
//
|
||||
// There will be only one FormConfig in the system
|
||||
// If there is another out there, someone is trying to install us
|
||||
// again. Fail that scenario.
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiFormBrowserProtocolGuid,
|
||||
NULL,
|
||||
&gBrowser
|
||||
);
|
||||
|
||||
//
|
||||
// This example does not implement worker functions
|
||||
// for the NV accessor functions. Only a callback evaluator
|
||||
//
|
||||
FrontPageCallback.NvRead = NULL;
|
||||
FrontPageCallback.NvWrite = NULL;
|
||||
FrontPageCallback.Callback = FrontPageCallbackRoutine;
|
||||
|
||||
//
|
||||
// Install protocol interface
|
||||
//
|
||||
FrontPageCallbackHandle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&FrontPageCallbackHandle,
|
||||
&gEfiFormCallbackProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&FrontPageCallback
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
ReInitStrings:
|
||||
//
|
||||
// BugBug: This logic is in BdsInitLanguage. It should not be in two places!
|
||||
//
|
||||
BufferSize = 4;
|
||||
Status = gRT->GetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&BufferSize,
|
||||
AsciiLang
|
||||
);
|
||||
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
UnicodeLang[Index] = (CHAR16) AsciiLang[Index];
|
||||
}
|
||||
|
||||
UnicodeLang[3] = 0;
|
||||
|
||||
//
|
||||
// Allocate space for creation of UpdateData Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
OptionList = AllocateZeroPool (0x1000);
|
||||
ASSERT (OptionList != NULL);
|
||||
|
||||
//
|
||||
// Flag update pending in FormSet
|
||||
//
|
||||
UpdateData->FormSetUpdate = TRUE;
|
||||
//
|
||||
// Register CallbackHandle data for FormSet
|
||||
//
|
||||
UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FrontPageCallbackHandle;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
//
|
||||
// Collect the languages from what our current Language support is based on our VFR
|
||||
//
|
||||
Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
|
||||
|
||||
OptionCount = 0;
|
||||
|
||||
//
|
||||
// Try for a 512 byte Buffer
|
||||
//
|
||||
BufferSize = 0x200;
|
||||
|
||||
//
|
||||
// Allocate memory for our Form binary
|
||||
//
|
||||
StringBuffer = AllocateZeroPool (BufferSize);
|
||||
ASSERT (StringBuffer != NULL);
|
||||
|
||||
for (Index = 0; LanguageString[Index] != 0; Index += 3) {
|
||||
Token = 0;
|
||||
CopyMem (Lang, &LanguageString[Index], 6);
|
||||
Lang[3] = 0;
|
||||
|
||||
if (!StrCmp (Lang, UnicodeLang)) {
|
||||
mLastSelection = (UINT16) OptionCount;
|
||||
}
|
||||
|
||||
Status = Hii->GetString (Hii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, StringBuffer);
|
||||
Hii->NewString (Hii, NULL, gStringPackHandle, &Token, StringBuffer);
|
||||
CopyMem (&OptionList[OptionCount].StringToken, &Token, sizeof (UINT16));
|
||||
CopyMem (&OptionList[OptionCount].Value, &OptionCount, sizeof (UINT16));
|
||||
Key = 0x1234;
|
||||
CopyMem (&OptionList[OptionCount].Key, &Key, sizeof (UINT16));
|
||||
OptionList[OptionCount].Flags = EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS;
|
||||
OptionCount++;
|
||||
}
|
||||
|
||||
gBS->FreePool (LanguageString);
|
||||
|
||||
if (ReInitializeStrings) {
|
||||
gBS->FreePool (StringBuffer);
|
||||
gBS->FreePool (OptionList);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = CreateOneOfOpCode (
|
||||
FRONT_PAGE_QUESTION_ID, // Question ID
|
||||
FRONT_PAGE_DATA_WIDTH, // Data Width
|
||||
(STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT), // Prompt Token
|
||||
(STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT_HELP), // Help Token
|
||||
OptionList, // List of Options
|
||||
OptionCount, // Number of Options
|
||||
&UpdateData->Data // Data Buffer
|
||||
);
|
||||
|
||||
//
|
||||
// Assign the number of options and the oneof and endoneof op-codes to count
|
||||
//
|
||||
UpdateData->DataCount = (UINT8) (OptionCount + 2);
|
||||
|
||||
Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
|
||||
|
||||
gBS->FreePool (UpdateData);
|
||||
//
|
||||
// gBS->FreePool (OptionList);
|
||||
//
|
||||
gBS->FreePool (StringBuffer);
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CallFrontPage (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Call the browser and display the front page
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 FakeNvRamMap[1];
|
||||
|
||||
//
|
||||
// Begin waiting for USER INPUT
|
||||
//
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_PROGRESS_CODE,
|
||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
|
||||
);
|
||||
|
||||
FakeNvRamMap[0] = (UINT8) mLastSelection;
|
||||
Status = gBrowser->SendForm (
|
||||
gBrowser,
|
||||
TRUE, // Use the database
|
||||
&gFrontPageHandle, // The HII Handle
|
||||
1,
|
||||
NULL,
|
||||
FrontPageCallbackHandle, // This is the handle that the interface to the callback was installed on
|
||||
FakeNvRamMap,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
Hii->ResetStrings (Hii, gFrontPageHandle);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetStringFromToken (
|
||||
IN EFI_GUID *ProducerGuid,
|
||||
IN STRING_REF Token,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Acquire the string associated with the ProducerGuid and return it.
|
||||
|
||||
Arguments:
|
||||
|
||||
ProducerGuid - The Guid to search the HII database for
|
||||
Token - The token value of the string to extract
|
||||
String - The string that is extracted
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The function returns EFI_SUCCESS always.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 HandleBufferLength;
|
||||
EFI_HII_HANDLE *HiiHandleBuffer;
|
||||
UINTN StringBufferLength;
|
||||
UINTN NumberOfHiiHandles;
|
||||
UINTN Index;
|
||||
UINT16 Length;
|
||||
EFI_GUID HiiGuid;
|
||||
|
||||
HandleBufferLength = 0x1000;
|
||||
HiiHandleBuffer = NULL;
|
||||
|
||||
//
|
||||
// Get all the Hii handles
|
||||
//
|
||||
HiiHandleBuffer = AllocateZeroPool (HandleBufferLength);
|
||||
|
||||
Status = Hii->FindHandles (Hii, &HandleBufferLength, HiiHandleBuffer);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Get the Hii Handle that matches the StructureNode->ProducerName
|
||||
//
|
||||
NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
|
||||
for (Index = 0; Index < NumberOfHiiHandles; Index++) {
|
||||
Length = 0;
|
||||
Status = ExtractDataFromHiiHandle (
|
||||
HiiHandleBuffer[Index],
|
||||
&Length,
|
||||
NULL,
|
||||
&HiiGuid
|
||||
);
|
||||
if (CompareGuid (ProducerGuid, &HiiGuid)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Find the string based on the current language
|
||||
//
|
||||
StringBufferLength = 0x100;
|
||||
*String = AllocateZeroPool (0x100);
|
||||
Status = Hii->GetString (
|
||||
Hii,
|
||||
HiiHandleBuffer[Index],
|
||||
Token,
|
||||
FALSE,
|
||||
NULL,
|
||||
&StringBufferLength,
|
||||
*String
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (*String);
|
||||
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
||||
}
|
||||
|
||||
gBS->FreePool (HiiHandleBuffer);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConvertProcessorToString (
|
||||
IN EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert Processor Frequency Data to a string
|
||||
|
||||
Arguments:
|
||||
|
||||
ProcessorFrequency - The frequency data to process
|
||||
String - The string that is created
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *StringBuffer;
|
||||
UINTN Index;
|
||||
UINT32 FreqMhz;
|
||||
|
||||
if (ProcessorFrequency->Exponent >= 6) {
|
||||
FreqMhz = ProcessorFrequency->Value;
|
||||
for (Index = 0; Index < (UINTN) (ProcessorFrequency->Exponent - 6); Index++) {
|
||||
FreqMhz *= 10;
|
||||
}
|
||||
} else {
|
||||
FreqMhz = 0;
|
||||
}
|
||||
|
||||
StringBuffer = AllocateZeroPool (0x20);
|
||||
ASSERT (StringBuffer != NULL);
|
||||
Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);
|
||||
StrCat (StringBuffer, L".");
|
||||
UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);
|
||||
StrCat (StringBuffer, L" GHz");
|
||||
|
||||
*String = (CHAR16 *) StringBuffer;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
ConvertMemorySizeToString (
|
||||
IN UINT32 MemorySize,
|
||||
OUT CHAR16 **String
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Convert Memory Size to a string
|
||||
|
||||
Arguments:
|
||||
|
||||
MemorySize - The size of the memory to process
|
||||
String - The string that is created
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *StringBuffer;
|
||||
|
||||
StringBuffer = AllocateZeroPool (0x20);
|
||||
ASSERT (StringBuffer != NULL);
|
||||
UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);
|
||||
StrCat (StringBuffer, L" MB RAM");
|
||||
|
||||
*String = (CHAR16 *) StringBuffer;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
UpdateFrontPageStrings (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Update the banner information for the Front Page based on DataHub information
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
STRING_REF TokenToUpdate;
|
||||
CHAR16 *NewString;
|
||||
UINT64 MonotonicCount;
|
||||
EFI_DATA_HUB_PROTOCOL *DataHub;
|
||||
EFI_DATA_RECORD_HEADER *Record;
|
||||
EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
|
||||
EFI_MISC_BIOS_VENDOR_DATA *BiosVendor;
|
||||
EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemManufacturer;
|
||||
EFI_PROCESSOR_VERSION_DATA *ProcessorVersion;
|
||||
EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency;
|
||||
EFI_MEMORY_ARRAY_START_ADDRESS_DATA *MemoryArray;
|
||||
CHAR8 LangCode[3];
|
||||
CHAR16 Lang[3];
|
||||
UINTN Size;
|
||||
UINTN Index;
|
||||
BOOLEAN Find[5];
|
||||
|
||||
ZeroMem (Find, sizeof (Find));
|
||||
|
||||
//
|
||||
// Update Front Page strings
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDataHubProtocolGuid,
|
||||
NULL,
|
||||
&DataHub
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Size = 3;
|
||||
|
||||
Status = gRT->GetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
LangCode
|
||||
);
|
||||
|
||||
for (Index = 0; Index < 3; Index++) {
|
||||
Lang[Index] = (CHAR16) LangCode[Index];
|
||||
}
|
||||
|
||||
MonotonicCount = 0;
|
||||
Record = NULL;
|
||||
do {
|
||||
Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);
|
||||
if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
|
||||
DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
|
||||
if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
|
||||
(DataHeader->RecordType == EFI_MISC_BIOS_VENDOR_RECORD_NUMBER)
|
||||
) {
|
||||
BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);
|
||||
GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
|
||||
TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_BIOS_VERSION;
|
||||
Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
|
||||
gBS->FreePool (NewString);
|
||||
Find[0] = TRUE;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
|
||||
(DataHeader->RecordType == EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER)
|
||||
) {
|
||||
SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);
|
||||
GetStringFromToken (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);
|
||||
TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_COMPUTER_MODEL;
|
||||
Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
|
||||
gBS->FreePool (NewString);
|
||||
Find[1] = TRUE;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
|
||||
(DataHeader->RecordType == ProcessorVersionRecordType)
|
||||
) {
|
||||
ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);
|
||||
GetStringFromToken (&Record->ProducerName, *ProcessorVersion, &NewString);
|
||||
TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_MODEL;
|
||||
Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
|
||||
gBS->FreePool (NewString);
|
||||
Find[2] = TRUE;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
|
||||
(DataHeader->RecordType == ProcessorCoreFrequencyRecordType)
|
||||
) {
|
||||
ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);
|
||||
ConvertProcessorToString (ProcessorFrequency, &NewString);
|
||||
TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_SPEED;
|
||||
Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
|
||||
gBS->FreePool (NewString);
|
||||
Find[3] = TRUE;
|
||||
}
|
||||
|
||||
if (CompareGuid (&Record->DataRecordGuid, &mMemorySubClass) &&
|
||||
(DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)
|
||||
) {
|
||||
MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) (DataHeader + 1);
|
||||
ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress -
|
||||
MemoryArray->MemoryArrayStartAddress + 1), 20)),
|
||||
&NewString);
|
||||
TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_MEMORY_SIZE;
|
||||
Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
|
||||
gBS->FreePool (NewString);
|
||||
Find[4] = TRUE;
|
||||
}
|
||||
}
|
||||
} while (!EFI_ERROR (Status) && (MonotonicCount != 0) && !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
VOID
|
||||
PlatformBdsEnterFrontPage (
|
||||
IN UINT16 TimeoutDefault,
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
This function is the main entry of the platform setup entry.
|
||||
The function will present the main menu of the system setup,
|
||||
this is the platform reference part and can be customize.
|
||||
|
||||
Arguments:
|
||||
TimeoutDefault - The fault time out value before the system
|
||||
continue to boot.
|
||||
ConnectAllHappened - The indicater to check if the connect all have
|
||||
already happended.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_UPDATE_DATA *UpdateData;
|
||||
EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
|
||||
|
||||
//
|
||||
// Indicate if we need connect all in the platform setup
|
||||
//
|
||||
if (ConnectAllHappened) {
|
||||
gConnectAllHappened = TRUE;
|
||||
}
|
||||
//
|
||||
// Allocate space for creation of Buffer
|
||||
//
|
||||
UpdateData = AllocateZeroPool (0x1000);
|
||||
ASSERT (UpdateData != NULL);
|
||||
|
||||
UpdateData->FormSetUpdate = FALSE;
|
||||
UpdateData->FormCallbackHandle = 0;
|
||||
UpdateData->FormUpdate = FALSE;
|
||||
UpdateData->FormTitle = 0;
|
||||
UpdateData->DataCount = 1;
|
||||
|
||||
//
|
||||
// Remove Banner Op-code if any at this label
|
||||
//
|
||||
Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, FALSE, UpdateData);
|
||||
|
||||
//
|
||||
// Create Banner Op-code which reflects correct timeout value
|
||||
//
|
||||
CreateBannerOpCode (
|
||||
STRING_TOKEN (STR_TIME_OUT_PROMPT),
|
||||
TimeoutDefault,
|
||||
(UINT8) EFI_IFR_BANNER_TIMEOUT,
|
||||
&UpdateData->Data
|
||||
);
|
||||
|
||||
//
|
||||
// Add Banner Op-code at this label
|
||||
//
|
||||
Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, TRUE, UpdateData);
|
||||
|
||||
do {
|
||||
|
||||
InitializeFrontPage (TRUE);
|
||||
|
||||
//
|
||||
// Update Front Page strings
|
||||
//
|
||||
UpdateFrontPageStrings ();
|
||||
|
||||
gCallbackKey = 0;
|
||||
PERF_START (0, "BdsTimeOut", "BDS", 0);
|
||||
Status = CallFrontPage ();
|
||||
PERF_END (0, "BdsTimeOut", "BDS", 0);
|
||||
|
||||
//
|
||||
// If gCallbackKey is greater than 1 and less or equal to 5,
|
||||
// it will lauch configuration utilities.
|
||||
// 2 = set language
|
||||
// 3 = boot manager
|
||||
// 4 = device manager
|
||||
// 5 = boot maintainenance manager
|
||||
//
|
||||
if ((gCallbackKey > 0x0001) && (gCallbackKey <= 0x0005)) {
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_PROGRESS_CODE,
|
||||
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)
|
||||
);
|
||||
}
|
||||
//
|
||||
// Based on the key that was set, we can determine what to do
|
||||
//
|
||||
switch (gCallbackKey) {
|
||||
//
|
||||
// The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
|
||||
// describe to their customers in documentation how to find their setup information (namely
|
||||
// under the device manager and specific buckets)
|
||||
//
|
||||
// These entries consist of the Continue, Select language, Boot Manager, and Device Manager
|
||||
//
|
||||
case 0x0001:
|
||||
//
|
||||
// User hit continue
|
||||
//
|
||||
break;
|
||||
|
||||
case 0x0002:
|
||||
//
|
||||
// User made a language setting change - display front page again
|
||||
//
|
||||
break;
|
||||
|
||||
case 0x0003:
|
||||
//
|
||||
// User chose to run the Boot Manager
|
||||
//
|
||||
CallBootManager ();
|
||||
break;
|
||||
|
||||
case 0x0004:
|
||||
//
|
||||
// Display the Device Manager
|
||||
//
|
||||
do {
|
||||
CallDeviceManager();
|
||||
} while (gCallbackKey == 4);
|
||||
break;
|
||||
|
||||
case 0x0005:
|
||||
//
|
||||
// Display the Boot Maintenance Manager
|
||||
//
|
||||
BdsStartBootMaint ();
|
||||
break;
|
||||
}
|
||||
|
||||
} while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));
|
||||
|
||||
//
|
||||
// Automatically load current entry
|
||||
// Note: The following lines of code only execute when Auto boot
|
||||
// takes affect
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, &ConsoleControl);
|
||||
ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
|
||||
|
||||
}
|
100
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.h
Normal file
100
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPage.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
FrontPage.h
|
||||
|
||||
Abstract:
|
||||
|
||||
FrontPage routines to handle the callbacks and browser calls
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _FRONT_PAGE_H
|
||||
#define _FRONT_PAGE_H
|
||||
|
||||
#include "Generic/DeviceMngr/DeviceManager.h"
|
||||
#include "Generic/BootMaint/bootmaint.h"
|
||||
#include "Generic/BootMngr/BootManager.h"
|
||||
|
||||
//
|
||||
// This is the VFR compiler generated header file which defines the
|
||||
// string identifiers.
|
||||
//
|
||||
#include "BdsStrDefs.h"
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
#define EFI_VBIOS_CLASS 0x40
|
||||
|
||||
#define SET_VIDEO_BIOS_TYPE_QUESTION_ID 0x00
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT8 VideoBIOS;
|
||||
} MyDevMgrIfrNVData;
|
||||
#pragma pack()
|
||||
|
||||
#define EFI_FP_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'P', 'C', 'B')
|
||||
#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
|
||||
CR (a, \
|
||||
EFI_FRONTPAGE_CALLBACK_INFO, \
|
||||
DevMgrCallback, \
|
||||
EFI_FP_CALLBACK_DATA_SIGNATURE \
|
||||
)
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
MyDevMgrIfrNVData Data;
|
||||
EFI_HII_HANDLE DevMgrHiiHandle;
|
||||
EFI_HANDLE CallbackHandle;
|
||||
EFI_FORM_CALLBACK_PROTOCOL DevMgrCallback;
|
||||
} EFI_FRONTPAGE_CALLBACK_INFO;
|
||||
|
||||
//
|
||||
// These are the VFR compiler generated data representing our VFR data.
|
||||
//
|
||||
// BugBug: we should put g in front of these tool generated globals.
|
||||
// maybe even gVrf would be a better prefix
|
||||
//
|
||||
extern UINT8 FrontPageVfrBin[];
|
||||
extern UINT8 FrontPageStringsStr[];
|
||||
extern UINT8 DeviceManagerVfrBin[];
|
||||
extern UINT8 DeviceManagerStringsStr[];
|
||||
|
||||
#define FRONT_PAGE_QUESTION_ID 0x0000
|
||||
#define FRONT_PAGE_DATA_WIDTH 0x01
|
||||
|
||||
EFI_STATUS
|
||||
InitializeFrontPage (
|
||||
IN BOOLEAN ReInitializeStrings
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
TimeCompare (
|
||||
IN EFI_TIME *FirstTime,
|
||||
IN EFI_TIME *SecondTime
|
||||
);
|
||||
|
||||
VOID
|
||||
PlatformBdsEnterFrontPage (
|
||||
IN UINT16 TimeoutDefault,
|
||||
IN BOOLEAN ConnectAllHappened
|
||||
);
|
||||
|
||||
#endif // _FRONT_PAGE_H_
|
||||
|
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageStrings.uni
Normal file
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageStrings.uni
Normal file
Binary file not shown.
159
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageVfr.Vfr
Normal file
159
EdkNt32Pkg/Dxe/PlatformBds/Generic/FrontPageVfr.Vfr
Normal file
@@ -0,0 +1,159 @@
|
||||
// *++
|
||||
//
|
||||
// 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:
|
||||
//
|
||||
// FrontPageVfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Browser formset.
|
||||
//
|
||||
// Revision History:
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "BdsStrDefs.h"
|
||||
|
||||
#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, { 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe } }
|
||||
|
||||
#define FRONT_PAGE_ITEM_ONE 0x0001
|
||||
#define FRONT_PAGE_ITEM_TWO 0x0002
|
||||
#define FRONT_PAGE_ITEM_THREE 0x0003
|
||||
#define FRONT_PAGE_ITEM_FOUR 0x0004
|
||||
#define FRONT_PAGE_ITEM_FIVE 0x0005
|
||||
|
||||
#define FRONT_PAGE_TIMEOUT 0xFFFF
|
||||
#define FRONT_PAGE_CLASS 0x0000
|
||||
#define FRONT_PAGE_SUBCLASS 0x0002
|
||||
|
||||
formset
|
||||
guid = FORMSET_GUID,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
class = FRONT_PAGE_CLASS,
|
||||
subclass = FRONT_PAGE_SUBCLASS,
|
||||
|
||||
form formid = 0x1000,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
|
||||
line 0,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
|
||||
line 1,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
|
||||
line 1,
|
||||
align right;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
|
||||
line 2,
|
||||
align left;
|
||||
|
||||
banner
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
|
||||
line 2,
|
||||
align right;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_LEFT),
|
||||
// line 0,
|
||||
// align left;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_RIGHT),
|
||||
// line 0,
|
||||
// align right;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_LEFT),
|
||||
// line 1,
|
||||
// align left;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_RIGHT),
|
||||
// line 1,
|
||||
// align right;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_2_LEFT),
|
||||
// line 2,
|
||||
// align left;
|
||||
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_3_LEFT),
|
||||
// line 3,
|
||||
// align left;
|
||||
|
||||
goto FRONT_PAGE_ITEM_ONE,
|
||||
prompt = STRING_TOKEN(STR_CONTINUE_PROMPT),
|
||||
help = STRING_TOKEN(STR_CONTINUE_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = 0x0001;
|
||||
|
||||
label FRONT_PAGE_ITEM_TWO;
|
||||
//
|
||||
// This is where we will dynamically add a OneOf type op-code to select Languages from the
|
||||
// currently available choices
|
||||
//
|
||||
|
||||
goto FRONT_PAGE_ITEM_THREE,
|
||||
prompt = STRING_TOKEN(STR_BOOT_MANAGER),
|
||||
help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = 0x1064;
|
||||
|
||||
goto FRONT_PAGE_ITEM_FOUR,
|
||||
prompt = STRING_TOKEN(STR_DEVICE_MANAGER),
|
||||
help = STRING_TOKEN(STR_DEVICE_MANAGER_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = 0x8567;
|
||||
|
||||
goto FRONT_PAGE_ITEM_FIVE,
|
||||
prompt = STRING_TOKEN(STR_BOOT_MAINT_MANAGER),
|
||||
help = STRING_TOKEN(STR_BOOT_MAINT_MANAGER_HELP),
|
||||
flags = INTERACTIVE | NV_ACCESS,
|
||||
key = 0x9876;
|
||||
|
||||
label FRONT_PAGE_TIMEOUT;
|
||||
// If one wanted to hard-code a value one could do it below, but our implementation follows EFI architecture
|
||||
// and honors the TimeOut NV variable
|
||||
//
|
||||
// banner
|
||||
// title = STRING_TOKEN(STR_TIME_OUT_PROMPT),
|
||||
// timeout = 0x000A;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FRONT_PAGE_ITEM_ONE,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
endform;
|
||||
|
||||
form formid = FRONT_PAGE_ITEM_THREE,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
endform;
|
||||
|
||||
form formid = FRONT_PAGE_ITEM_FOUR,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
endform;
|
||||
|
||||
form formid = FRONT_PAGE_ITEM_FIVE,
|
||||
title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
|
||||
endform;
|
||||
|
||||
endformset;
|
431
EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c
Normal file
431
EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.c
Normal file
@@ -0,0 +1,431 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
language.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Language settings
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "String.h"
|
||||
#include "Language.h"
|
||||
|
||||
#define NARROW_GLYPH_NUMBER 8
|
||||
#define WIDE_GLYPH_NUMBER 75
|
||||
|
||||
//
|
||||
// Default language code, currently is English
|
||||
//
|
||||
CHAR8 *mDefaultLangCode = "eng";
|
||||
|
||||
typedef struct {
|
||||
EFI_HII_FONT_PACK FixedLength;
|
||||
EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
|
||||
EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
|
||||
} FONT_PACK;
|
||||
|
||||
FONT_PACK mFontPack = {
|
||||
sizeof (EFI_HII_FONT_PACK) + (NARROW_GLYPH_NUMBER * sizeof (EFI_NARROW_GLYPH)) + (WIDE_GLYPH_NUMBER * sizeof (EFI_WIDE_GLYPH)),
|
||||
EFI_HII_FONT,
|
||||
NARROW_GLYPH_NUMBER,
|
||||
WIDE_GLYPH_NUMBER,
|
||||
{ // Narrow Glyphs
|
||||
{
|
||||
0x05d0,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x4E,
|
||||
0x6E,
|
||||
0x62,
|
||||
0x32,
|
||||
0x32,
|
||||
0x3C,
|
||||
0x68,
|
||||
0x4C,
|
||||
0x4C,
|
||||
0x46,
|
||||
0x76,
|
||||
0x72,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d1,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x78,
|
||||
0x7C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x7E,
|
||||
0x7E,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d2,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x78,
|
||||
0x7C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x1C,
|
||||
0x3E,
|
||||
0x66,
|
||||
0x66,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d3,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x7E,
|
||||
0x7E,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d4,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x7C,
|
||||
0x7E,
|
||||
0x06,
|
||||
0x06,
|
||||
0x06,
|
||||
0x06,
|
||||
0x66,
|
||||
0x66,
|
||||
0x66,
|
||||
0x66,
|
||||
0x66,
|
||||
0x66,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d5,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x3C,
|
||||
0x3C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x0C,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x05d6,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x38,
|
||||
0x38,
|
||||
0x1E,
|
||||
0x1E,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x18,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
},
|
||||
{
|
||||
0x0000,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
}
|
||||
},
|
||||
{ // Wide Glyphs
|
||||
{
|
||||
0x0020,
|
||||
0x00,
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
},
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
},
|
||||
{
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}
|
||||
}, //
|
||||
}
|
||||
};
|
||||
|
||||
VOID
|
||||
ExportFonts (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_HII_HANDLE HiiHandle;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
|
||||
PackageList = PreparePackages (1, NULL, &mFontPack);
|
||||
//
|
||||
// Register our Fonts into the global database
|
||||
//
|
||||
HiiHandle = 0;
|
||||
Hii->NewPack (Hii, PackageList, &HiiHandle);
|
||||
|
||||
gBS->FreePool (PackageList);
|
||||
}
|
||||
|
||||
VOID
|
||||
InitializeLanguage (
|
||||
BOOLEAN LangCodesSettingRequired
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Determine the current language that will be used
|
||||
based on language related EFI Variables
|
||||
|
||||
Arguments:
|
||||
LangCodesSettingRequired - If required to set LangCode variable
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
UINTN Size;
|
||||
CHAR8 LangCode[ISO_639_2_ENTRY_SIZE];
|
||||
CHAR8 *LangCodes;
|
||||
CHAR16 *LanguageString;
|
||||
|
||||
LanguageString = NULL;
|
||||
LangCodes = NULL;
|
||||
|
||||
ExportFonts ();
|
||||
|
||||
//
|
||||
// Collect the languages from what our current Language support is based on our VFR
|
||||
//
|
||||
Hii->GetPrimaryLanguages (Hii, gStringPackHandle, &LanguageString);
|
||||
|
||||
LangCodes = AllocatePool (StrLen (LanguageString));
|
||||
ASSERT (LangCodes);
|
||||
|
||||
//
|
||||
// Convert LanguageString from Unicode to EFI defined ASCII LangCodes
|
||||
//
|
||||
for (Index = 0; LanguageString[Index] != 0x0000; Index++) {
|
||||
LangCodes[Index] = (CHAR8) LanguageString[Index];
|
||||
}
|
||||
|
||||
LangCodes[Index] = 0;
|
||||
|
||||
if (LangCodesSettingRequired) {
|
||||
Status = gRT->SetVariable (
|
||||
L"LangCodes",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
AsciiStrLen (LangCodes),
|
||||
LangCodes
|
||||
);
|
||||
}
|
||||
//
|
||||
// Find current LangCode from Lang NV Variable
|
||||
//
|
||||
Size = ISO_639_2_ENTRY_SIZE;
|
||||
Status = gRT->GetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL,
|
||||
&Size,
|
||||
&LangCode
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
|
||||
if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// If we cannot get language code from Lang variable,
|
||||
// or LangCode cannot be found from language table,
|
||||
// set the mDefaultLangCode to Lang variable.
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = gRT->SetVariable (
|
||||
L"Lang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
ISO_639_2_ENTRY_SIZE,
|
||||
mDefaultLangCode
|
||||
);
|
||||
}
|
||||
|
||||
if (LangCodes) {
|
||||
gBS->FreePool (LangCodes);
|
||||
}
|
||||
|
||||
if (LanguageString != NULL) {
|
||||
gBS->FreePool (LanguageString);
|
||||
}
|
||||
|
||||
}
|
36
EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.h
Normal file
36
EdkNt32Pkg/Dxe/PlatformBds/Generic/Language.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
Language.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Language setting
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _LANGUAGE_H
|
||||
#define _LANGUAGE_H
|
||||
|
||||
#ifndef ISO_639_2_ENTRY_SIZE
|
||||
#define ISO_639_2_ENTRY_SIZE 3
|
||||
#endif
|
||||
|
||||
VOID
|
||||
InitializeLanguage (
|
||||
BOOLEAN LangCodesSettingRequired
|
||||
);
|
||||
|
||||
#endif // _LANGUAGE_H_
|
386
EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
Normal file
386
EdkNt32Pkg/Dxe/PlatformBds/Generic/MemoryTest.c
Normal file
@@ -0,0 +1,386 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
MemoryTest.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Perform the platform memory test
|
||||
|
||||
--*/
|
||||
|
||||
#include "bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
#include "String.h"
|
||||
|
||||
//
|
||||
// BDS Platform Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
PlatformBdsShowProgress (
|
||||
IN EFI_UGA_PIXEL TitleForeground,
|
||||
IN EFI_UGA_PIXEL TitleBackground,
|
||||
IN CHAR16 *Title,
|
||||
IN EFI_UGA_PIXEL ProgressColor,
|
||||
IN UINTN Progress,
|
||||
IN UINTN PreviousValue
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Show progress bar with title above it. It only works in UGA mode.
|
||||
|
||||
Arguments:
|
||||
|
||||
TitleForeground - Foreground color for Title.
|
||||
TitleBackground - Background color for Title.
|
||||
Title - Title above progress bar.
|
||||
ProgressColor - Progress bar color.
|
||||
Progress - Progress (0-100)
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_STATUS - Success update the progress bar
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
UINT32 SizeOfX;
|
||||
UINT32 SizeOfY;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
EFI_UGA_PIXEL Color;
|
||||
UINTN BlockHeight;
|
||||
UINTN BlockWidth;
|
||||
UINTN BlockNum;
|
||||
UINTN PosX;
|
||||
UINTN PosY;
|
||||
UINTN Index;
|
||||
|
||||
if (Progress > 100) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gST->ConsoleOutHandle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
&UgaDraw
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = UgaDraw->GetMode (
|
||||
UgaDraw,
|
||||
&SizeOfX,
|
||||
&SizeOfY,
|
||||
&ColorDepth,
|
||||
&RefreshRate
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
BlockWidth = SizeOfX / 100;
|
||||
BlockHeight = SizeOfY / 50;
|
||||
|
||||
BlockNum = Progress;
|
||||
|
||||
PosX = 0;
|
||||
PosY = SizeOfY * 48 / 50;
|
||||
|
||||
if (BlockNum == 0) {
|
||||
//
|
||||
// Clear progress area
|
||||
//
|
||||
SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0x0);
|
||||
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
&Color,
|
||||
EfiUgaVideoFill,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
PosY - GLYPH_HEIGHT - 1,
|
||||
SizeOfX,
|
||||
SizeOfY - (PosY - GLYPH_HEIGHT - 1),
|
||||
SizeOfX * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
//
|
||||
// Show progress by drawing blocks
|
||||
//
|
||||
for (Index = PreviousValue; Index < BlockNum; Index++) {
|
||||
PosX = Index * BlockWidth;
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
&ProgressColor,
|
||||
EfiUgaVideoFill,
|
||||
0,
|
||||
0,
|
||||
PosX,
|
||||
PosY,
|
||||
BlockWidth - 1,
|
||||
BlockHeight,
|
||||
(BlockWidth) * sizeof (EFI_UGA_PIXEL)
|
||||
);
|
||||
}
|
||||
|
||||
PrintXY (
|
||||
(SizeOfX - StrLen (Title) * GLYPH_WIDTH) / 2,
|
||||
PosY - GLYPH_HEIGHT - 1,
|
||||
&TitleForeground,
|
||||
&TitleBackground,
|
||||
Title
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
BdsMemoryTest (
|
||||
IN EXTENDMEM_COVERAGE_LEVEL Level
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Perform the memory test base on the memory test intensive level,
|
||||
and update the memory resource.
|
||||
|
||||
Arguments:
|
||||
|
||||
Level - The memory test intensive level.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_STATUS - Success test all the system memory and update
|
||||
the memory resource
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS InitStatus;
|
||||
EFI_STATUS KeyStatus;
|
||||
EFI_STATUS ReturnStatus;
|
||||
BOOLEAN RequireSoftECCInit;
|
||||
EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
|
||||
UINT64 TestedMemorySize;
|
||||
UINT64 TotalMemorySize;
|
||||
UINTN TestPercent;
|
||||
UINT64 PreviousValue;
|
||||
BOOLEAN ErrorOut;
|
||||
BOOLEAN TestAbort;
|
||||
EFI_INPUT_KEY Key;
|
||||
CHAR16 StrPercent[16];
|
||||
CHAR16 *StrTotalMemory;
|
||||
CHAR16 *Pos;
|
||||
CHAR16 *TmpStr;
|
||||
EFI_UGA_PIXEL Foreground;
|
||||
EFI_UGA_PIXEL Background;
|
||||
EFI_UGA_PIXEL Color;
|
||||
UINT8 Value;
|
||||
UINTN DataSize;
|
||||
UINT32 Attributes;
|
||||
|
||||
ReturnStatus = EFI_SUCCESS;
|
||||
ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
|
||||
|
||||
Pos = AllocatePool (128);
|
||||
|
||||
if (Pos == NULL) {
|
||||
return ReturnStatus;
|
||||
}
|
||||
|
||||
StrTotalMemory = Pos;
|
||||
|
||||
TestedMemorySize = 0;
|
||||
TotalMemorySize = 0;
|
||||
PreviousValue = 0;
|
||||
ErrorOut = FALSE;
|
||||
TestAbort = FALSE;
|
||||
|
||||
SetMem (&Foreground, sizeof (EFI_UGA_PIXEL), 0xff);
|
||||
SetMem (&Background, sizeof (EFI_UGA_PIXEL), 0x0);
|
||||
SetMem (&Color, sizeof (EFI_UGA_PIXEL), 0xff);
|
||||
|
||||
RequireSoftECCInit = FALSE;
|
||||
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
|
||||
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiGenericMemTestProtocolGuid,
|
||||
NULL,
|
||||
&GenMemoryTest
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (Pos);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
InitStatus = GenMemoryTest->MemoryTestInit (
|
||||
GenMemoryTest,
|
||||
Level,
|
||||
&RequireSoftECCInit
|
||||
);
|
||||
if (InitStatus == EFI_NO_MEDIA) {
|
||||
//
|
||||
// The PEI codes also have the relevant memory test code to check the memory,
|
||||
// it can select to test some range of the memory or all of them. If PEI code
|
||||
// checks all the memory, this BDS memory test will has no not-test memory to
|
||||
// do the test, and then the status of EFI_NO_MEDIA will be returned by
|
||||
// "MemoryTestInit". So it does not need to test memory again, just return.
|
||||
//
|
||||
gBS->FreePool (Pos);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
|
||||
|
||||
if (TmpStr != NULL) {
|
||||
gST->ConOut->OutputString (gST->ConOut, TmpStr);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
do {
|
||||
Status = GenMemoryTest->PerformMemoryTest (
|
||||
GenMemoryTest,
|
||||
&TestedMemorySize,
|
||||
&TotalMemorySize,
|
||||
&ErrorOut,
|
||||
TestAbort
|
||||
);
|
||||
if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));
|
||||
if (TmpStr != NULL) {
|
||||
PrintXY (10, 10, NULL, NULL, TmpStr);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);
|
||||
gST->ConOut->OutputString (gST->ConOut, TmpStr);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
TestPercent = (UINTN) DivU64x32 (
|
||||
DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
|
||||
(UINTN)DivU64x32 (TotalMemorySize, 16)
|
||||
);
|
||||
if (TestPercent != PreviousValue) {
|
||||
UnicodeValueToString (StrPercent, 0, TestPercent, 0);
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
|
||||
if (TmpStr != NULL) {
|
||||
BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
|
||||
if (TmpStr != NULL) {
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
TestPercent,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
}
|
||||
|
||||
PreviousValue = TestPercent;
|
||||
|
||||
KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (Key.ScanCode == SCAN_ESC) {
|
||||
if (!RequireSoftECCInit) {
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
|
||||
if (TmpStr != NULL) {
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
TmpStr,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
||||
gST->ConOut->OutputString (gST->ConOut, L"100");
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
TestAbort = TRUE;
|
||||
}
|
||||
} while (Status != EFI_NOT_FOUND);
|
||||
|
||||
Status = GenMemoryTest->Finished (GenMemoryTest);
|
||||
|
||||
Done:
|
||||
UnicodeValueToString (StrTotalMemory, COMMA_TYPE, (UINTN) TotalMemorySize, 0);
|
||||
if (StrTotalMemory[0] == L',') {
|
||||
StrTotalMemory++;
|
||||
}
|
||||
|
||||
TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
|
||||
if (TmpStr != NULL) {
|
||||
StrCat (StrTotalMemory, TmpStr);
|
||||
gBS->FreePool (TmpStr);
|
||||
}
|
||||
|
||||
gST->ConOut->ClearScreen (gST->ConOut);
|
||||
gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
|
||||
gST->ConOut->EnableCursor (gST->ConOut, FALSE);
|
||||
gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);
|
||||
PlatformBdsShowProgress (
|
||||
Foreground,
|
||||
Background,
|
||||
StrTotalMemory,
|
||||
Color,
|
||||
100,
|
||||
(UINTN) PreviousValue
|
||||
);
|
||||
|
||||
gBS->FreePool (Pos);
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"BootState",
|
||||
&gEfiBootStateGuid,
|
||||
&Attributes,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Value = 1;
|
||||
gRT->SetVariable (
|
||||
L"BootState",
|
||||
&gEfiBootStateGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (Value),
|
||||
&Value
|
||||
);
|
||||
}
|
||||
|
||||
return ReturnStatus;
|
||||
}
|
133
EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c
Normal file
133
EdkNt32Pkg/Dxe/PlatformBds/Generic/String.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
string.c
|
||||
|
||||
Abstract:
|
||||
|
||||
String support
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Bds.h"
|
||||
#include "String.h"
|
||||
#include "Language.h"
|
||||
|
||||
extern UINT8 BdsStrings[];
|
||||
|
||||
EFI_GUID gBdsStringPackGuid = { 0x7bac95d3, 0xddf, 0x42f3, 0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a };
|
||||
|
||||
EFI_STATUS
|
||||
InitializeStringSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize HII global accessor for string support
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
String from ID.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_PACKAGES *PackageList;
|
||||
//
|
||||
// There should only ever be one HII protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiHiiProtocolGuid,
|
||||
NULL,
|
||||
&Hii
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PackageList = PreparePackages (1, &gBdsStringPackGuid, BdsStrings);
|
||||
Status = Hii->NewPack (Hii, PackageList, &gStringPackHandle);
|
||||
gBS->FreePool (PackageList);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN STRING_REF Id
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get string by string id from HII Interface
|
||||
|
||||
Arguments:
|
||||
|
||||
Id - String ID.
|
||||
|
||||
Returns:
|
||||
|
||||
CHAR16 * - String from ID.
|
||||
NULL - If error occurs.
|
||||
|
||||
--*/
|
||||
{
|
||||
CHAR16 *String;
|
||||
UINTN StringLength;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Set default string size assumption at no more than 256 bytes
|
||||
//
|
||||
StringLength = 0x100;
|
||||
|
||||
String = AllocateZeroPool (StringLength);
|
||||
if (String == NULL) {
|
||||
//
|
||||
// If this happens, we are oh-so-dead, but return a NULL in any case.
|
||||
//
|
||||
return NULL;
|
||||
}
|
||||
//
|
||||
// Get the current string for the current Language
|
||||
//
|
||||
Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_BUFFER_TOO_SMALL) {
|
||||
//
|
||||
// Free the old pool
|
||||
//
|
||||
gBS->FreePool (String);
|
||||
|
||||
//
|
||||
// Allocate new pool with correct value
|
||||
//
|
||||
String = AllocatePool (StringLength);
|
||||
ASSERT (String != NULL);
|
||||
|
||||
Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return String;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return String;
|
||||
}
|
59
EdkNt32Pkg/Dxe/PlatformBds/Generic/String.h
Normal file
59
EdkNt32Pkg/Dxe/PlatformBds/Generic/String.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
string.h
|
||||
|
||||
Abstract:
|
||||
|
||||
String support
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
|
||||
//
|
||||
// This is the VFR compiler generated header file which defines the
|
||||
// string identifiers.
|
||||
//
|
||||
#include "BdsStrDefs.h"
|
||||
|
||||
//
|
||||
// String Definition Guid for BDS Platform
|
||||
//
|
||||
#define EFI_BDS_PLATFORM_GUID \
|
||||
{ \
|
||||
0x7777E939, 0xD57E, 0x4DCB, {0xA0, 0x8E, 0x64, 0xD7, 0x98, 0x57, 0x1E, 0x0F } \
|
||||
}
|
||||
|
||||
EFI_HII_HANDLE gStringPackHandle;
|
||||
EFI_HII_PROTOCOL *Hii;
|
||||
|
||||
CHAR16 *
|
||||
GetStringById (
|
||||
IN STRING_REF Id
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
InitializeStringSupport (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
CallFrontPage (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // _STRING_H_
|
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/Strings.uni
Normal file
BIN
EdkNt32Pkg/Dxe/PlatformBds/Generic/Strings.uni
Normal file
Binary file not shown.
54
EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.mbd
Normal file
54
EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.mbd
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdHeader>
|
||||
<BaseName>Bds</BaseName>
|
||||
<Guid>A6F691AC-31C8-4444-854C-E2C1A6950F92</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>
|
||||
<Created>2006-03-13 17:04</Created>
|
||||
<Modified>2006-03-23 14:14</Modified>
|
||||
</MbdHeader>
|
||||
<Libraries>
|
||||
<Library>UefiBootServicesTableLib</Library>
|
||||
<Library>UefiRuntimeServicesTableLib</Library>
|
||||
<Library>BaseLib</Library>
|
||||
<Library>UefiLib</Library>
|
||||
<Library>UefiMemoryLib</Library>
|
||||
<Library>UefiDriverEntryPoint</Library>
|
||||
<Library>DxeServicesTableLib</Library>
|
||||
<Library>DxeReportStatusCodeLib</Library>
|
||||
<Library>BaseDebugLibReportStatusCode</Library>
|
||||
<Library>EdkGenericBdsLib</Library>
|
||||
<Library>BasePrintLib</Library>
|
||||
<Library>EdkGraphicsLib</Library>
|
||||
<Library>EdkIfrSupportLib</Library>
|
||||
<Library>HiiLib</Library>
|
||||
<Library>DxeHobLib</Library>
|
||||
<Library>DxeMemoryAllocationLib</Library>
|
||||
<Library>UefiDevicePathLib</Library>
|
||||
<Library>BasePerformanceLibNull</Library>
|
||||
</Libraries>
|
||||
<BuildOptions ToolChain="MSFT">
|
||||
<ImageEntryPoint>_ModuleEntryPoint</ImageEntryPoint>
|
||||
<Option>DPX_SOURCE = ${PLATFORM_BDS_FILE_PATH}\Bds.dxs</Option>
|
||||
</BuildOptions>
|
||||
</ModuleBuildDescription>
|
151
EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.msa
Normal file
151
EdkNt32Pkg/Dxe/PlatformBds/PlatformBds.msa
Normal file
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaHeader>
|
||||
<BaseName>Bds</BaseName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<ComponentType>BS_DRIVER</ComponentType>
|
||||
<Guid>A6F691AC-31C8-4444-854C-E2C1A6950F92</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for DxeIpl module</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004-2006, 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>0</Specification>
|
||||
<Created>2006-03-13 17:04</Created>
|
||||
<Updated>2006-03-23 14:14</Updated>
|
||||
</MsaHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DebugLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiDriverEntryPoint</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PcdLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">EdkGraphicsLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DxeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PerformanceLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">PrintLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">EdkIfrSupportLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">ReportStatusCodeLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HobLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">EdkGenericBdsLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">MemoryAllocationLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiBootServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">UefiRuntimeServicesTableLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">DevicePathLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">HiiLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PlatformData.c</Filename>
|
||||
<Filename>BdsPlatform.c</Filename>
|
||||
<Filename>Generic\BdsEntry.c</Filename>
|
||||
<Filename>Generic\FrontPage.c</Filename>
|
||||
<Filename>Generic\FrontPageStrings.uni</Filename>
|
||||
<Filename>Generic\FrontPageVfr.vfr</Filename>
|
||||
<Filename>Generic\Language.c</Filename>
|
||||
<Filename>Generic\String.c</Filename>
|
||||
<Filename>Generic\Strings.uni</Filename>
|
||||
<Filename>Generic\Capsules.c</Filename>
|
||||
<Filename>Generic\MemoryTest.c</Filename>
|
||||
<Filename>Generic\BootMaint\BmString.uni</Filename>
|
||||
<Filename>Generic\BootMaint\bm.vfr</Filename>
|
||||
<Filename>Generic\BootMaint\BmLib.c</Filename>
|
||||
<Filename>Generic\BootMaint\BootOption.c</Filename>
|
||||
<Filename>Generic\BootMaint\ConsoleOption.c</Filename>
|
||||
<Filename>Generic\BootMaint\Data.c</Filename>
|
||||
<Filename>Generic\BootMaint\Variable.c</Filename>
|
||||
<Filename>Generic\BootMaint\UpdatePage.c</Filename>
|
||||
<Filename>Generic\BootMaint\BBSsupport.c</Filename>
|
||||
<Filename>Generic\BootMaint\BootMaint.c</Filename>
|
||||
<Filename>Generic\BootMaint\FileExplorer.c</Filename>
|
||||
<Filename>Generic\BootMaint\FE.vfr</Filename>
|
||||
<Filename>Generic\BootMngr\BootManager.c</Filename>
|
||||
<Filename>Generic\BootMngr\BootManagerStrings.uni</Filename>
|
||||
<Filename>Generic\BootMngr\BootManagerVfr.Vfr</Filename>
|
||||
<Filename>Generic\DeviceMngr\DeviceManager.c</Filename>
|
||||
<Filename>Generic\DeviceMngr\DeviceManagerStrings.uni</Filename>
|
||||
<Filename>Generic\DeviceMngr\DeviceManagerVfr.Vfr</Filename>
|
||||
<Filename>Generic\Bds.dxs</Filename>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
<PackageName>EdkModulePkg</PackageName>
|
||||
<PackageName>EdkNt32Pkg</PackageName>
|
||||
</Includes>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">Bds</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">LegacyBios</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">UgaSplash</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">Hii</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">FormCallback</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DataHub</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">FormBrowser</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">ConsoleControl</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">CpuIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">UgaDraw</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">LoadFile</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">SimpleFileSystem</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">DevicePath</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">BlockIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">SerialIo</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">GenericMemTest</Protocol>
|
||||
<Protocol Usage="SOMETIMES_CONSUMED">Cpu</Protocol>
|
||||
<Protocol Usage="SOMETIMES_CONSUMED">DriverBinding</Protocol>
|
||||
</Protocols>
|
||||
<Hobs>
|
||||
<Hob Usage="SOMETIMES_CONSUMED" HobType="GUID_EXTENSION">
|
||||
<Name>FlashMapEntryData</Name>
|
||||
<C_Name>gEfiFlashMapHobGuid</C_Name>
|
||||
<Guid>0xb091e7d2, 0x5a0, 0x4198, 0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59</Guid>
|
||||
</Hob>
|
||||
<Hob Usage="SOMETIMES_CONSUMED" HobType="CAPSULE_VOLUME"></Hob>
|
||||
</Hobs>
|
||||
<DataHubs>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">BiosVendor</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">SystemManufacturer</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">ProcessorVersion</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">ProcessorFrequency</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">MemoryArray</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">SerialIoDevice</DataHubRecord>
|
||||
<DataHubRecord Usage="SOMETIMES_CONSUMED">SerialIoPort</DataHubRecord>
|
||||
</DataHubs>
|
||||
<Guids>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>BootState</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>GlobalVariable</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>FlashMapHob</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>FileSystemVolumeLabelInfoId</C_Name>
|
||||
</GuidEntry>
|
||||
<GuidEntry Usage="ALWAYS_CONSUMED">
|
||||
<C_Name>FileInfo</C_Name>
|
||||
</GuidEntry>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>BdsInitialize</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
182
EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c
Normal file
182
EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PlatformData.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Defined the platform specific device path which will be used by
|
||||
platform Bbd to perform the platform policy connect.
|
||||
|
||||
--*/
|
||||
|
||||
#include "Generic/Bds.h"
|
||||
#include "BdsPlatform.h"
|
||||
|
||||
//
|
||||
// Predefined platform default time out value
|
||||
//
|
||||
UINT16 gPlatformBootTimeOutDefault = 10;
|
||||
|
||||
//
|
||||
// Platform specific keyboard device path
|
||||
//
|
||||
NT_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath0 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_UGA_GUID,
|
||||
0
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
NT_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath1 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_UGA_GUID,
|
||||
1
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
//
|
||||
// Platform specific serial device path
|
||||
//
|
||||
NT_ISA_SERIAL_DEVICE_PATH gNtSerialDevicePath0 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_SERIAL_PORT_GUID
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_UART_DP,
|
||||
(UINT8) (sizeof (UART_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),
|
||||
0,
|
||||
115200,
|
||||
8,
|
||||
1,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
NT_ISA_SERIAL_DEVICE_PATH gNtSerialDevicePath1 = {
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
EFI_WIN_NT_THUNK_PROTOCOL_GUID
|
||||
},
|
||||
{
|
||||
HARDWARE_DEVICE_PATH,
|
||||
HW_VENDOR_DP,
|
||||
(UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),
|
||||
(UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),
|
||||
EFI_WIN_NT_SERIAL_PORT_GUID,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_UART_DP,
|
||||
(UINT8) (sizeof (UART_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8),
|
||||
0,
|
||||
115200,
|
||||
8,
|
||||
1,
|
||||
1
|
||||
},
|
||||
{
|
||||
MESSAGING_DEVICE_PATH,
|
||||
MSG_VENDOR_DP,
|
||||
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
|
||||
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
|
||||
DEVICE_PATH_MESSAGING_PC_ANSI
|
||||
},
|
||||
gEndEntire
|
||||
};
|
||||
|
||||
//
|
||||
// Predefined platform default console device path
|
||||
//
|
||||
BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = {
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath0,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gNtSerialDevicePath1,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath0,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath1,
|
||||
(CONSOLE_OUT | CONSOLE_IN)
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Predefined platform specific driver option
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[] = { NULL };
|
||||
|
||||
//
|
||||
// Predefined platform connect sequence
|
||||
//
|
||||
EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] = { NULL };
|
47
EdkNt32Pkg/Dxe/PlatformBds/build.xml
Normal file
47
EdkNt32Pkg/Dxe/PlatformBds/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- 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.-->
|
||||
<project basedir="." default="Bds"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Dxe\PlatformBds"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="Bds">
|
||||
<GenBuild baseName="Bds" mbdFilename="${MODULE_DIR}\PlatformBds.mbd" msaFilename="${MODULE_DIR}\PlatformBds.msa"/>
|
||||
</target>
|
||||
<target depends="Bds_clean" name="clean"/>
|
||||
<target depends="Bds_cleanall" name="cleanall"/>
|
||||
<target name="Bds_clean">
|
||||
<OutputDirSetup baseName="Bds" mbdFilename="${MODULE_DIR}\PlatformBds.mbd" msaFilename="${MODULE_DIR}\PlatformBds.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Bds_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Bds_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="Bds_cleanall">
|
||||
<OutputDirSetup baseName="Bds" mbdFilename="${MODULE_DIR}\PlatformBds.mbd" msaFilename="${MODULE_DIR}\PlatformBds.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\Bds_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\Bds_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**Bds*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
187
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
Normal file
187
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/ComponentName.c
Normal file
@@ -0,0 +1,187 @@
|
||||
/*++
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
// 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
|
||||
);
|
||||
}
|
338
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
Normal file
338
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverConfiguration.c
Normal file
@@ -0,0 +1,338 @@
|
||||
/*++
|
||||
|
||||
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;
|
||||
}
|
186
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
Normal file
186
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/DriverDiagnostics.c
Normal file
@@ -0,0 +1,186 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
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;
|
||||
gBS->AllocatePool (EfiBootServicesData, (UINTN) (*BufferSize), Buffer);
|
||||
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;
|
||||
}
|
1085
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
Normal file
1085
EdkNt32Pkg/Dxe/WinNtThunk/Bus/BlockIo/WinNtBlockIo.c
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user