Add PciBus & IdeBus
PciBus cannot build for now for some definition missing. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2852 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
210
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
Normal file
210
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
Normal file
@ -0,0 +1,210 @@
|
||||
/** @file
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "idebus.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = {
|
||||
IDEBusComponentNameGetDriverName,
|
||||
IDEBusComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
@param Language A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
@param DriverName A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
mIDEBusDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
@param ControllerHandle The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
@param ChildHandle The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
@param Language A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
@param ControllerName A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language
|
||||
specified by Language from the point of view of the
|
||||
driver specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlockIo;
|
||||
IDE_BLK_IO_DEV *IdeBlkIoDevice;
|
||||
|
||||
//
|
||||
// Make sure this driver is currently managing ControllHandle
|
||||
//
|
||||
Status = EfiTestManagedDevice (
|
||||
ControllerHandle,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
&gEfiIdeControllerInitProtocolGuid
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (ChildHandle == NULL) {
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
mIDEBusControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
||||
|
||||
Status = EfiTestChildHandle (
|
||||
ControllerHandle,
|
||||
ChildHandle,
|
||||
&gEfiPciIoProtocolGuid
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the child context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlockIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);
|
||||
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
IdeBlkIoDevice->ControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Add the component name for the IDE/ATAPI device
|
||||
|
||||
@param IdeBlkIoDevicePtr A pointer to the IDE_BLK_IO_DEV instance.
|
||||
|
||||
**/
|
||||
VOID
|
||||
AddName (
|
||||
IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
|
||||
)
|
||||
{
|
||||
UINTN StringIndex;
|
||||
CHAR16 ModelName[41];
|
||||
|
||||
//
|
||||
// Add Component Name for the IDE/ATAPI device that was discovered.
|
||||
//
|
||||
IdeBlkIoDevicePtr->ControllerNameTable = NULL;
|
||||
for (StringIndex = 0; StringIndex < 41; StringIndex++) {
|
||||
ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];
|
||||
}
|
||||
|
||||
AddUnicodeString (
|
||||
"eng",
|
||||
gIDEBusComponentName.SupportedLanguages,
|
||||
&IdeBlkIoDevicePtr->ControllerNameTable,
|
||||
ModelName
|
||||
);
|
||||
}
|
80
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
Normal file
80
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
Normal file
@ -0,0 +1,80 @@
|
||||
/** @file
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _IDE_BUS_COMPONENT_NAME_H
|
||||
#define _IDE_BUS_COMPONENT_NAME_H
|
||||
|
||||
#define ADD_NAME(x) AddName ((x));
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName;
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param Language TODO: add argument description
|
||||
@param DriverName TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param ControllerHandle TODO: add argument description
|
||||
@param ChildHandle TODO: add argument description
|
||||
@param Language TODO: add argument description
|
||||
@param ControllerName TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param IdeBlkIoDevicePtr TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
VOID
|
||||
AddName (
|
||||
IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
322
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
Normal file
322
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
Normal file
@ -0,0 +1,322 @@
|
||||
/** @file
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "idebus.h"
|
||||
|
||||
CHAR16 *OptionString[4] = {
|
||||
L"Enable Primary Master (Y/N)? -->",
|
||||
L"Enable Primary Slave (Y/N)? -->",
|
||||
L"Enable Secondary Master (Y/N)? -->",
|
||||
L"Enable Secondary Slave (Y/N)? -->"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Driver Configuration Protocol
|
||||
//
|
||||
EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration = {
|
||||
IDEBusDriverConfigurationSetOptions,
|
||||
IDEBusDriverConfigurationOptionsValid,
|
||||
IDEBusDriverConfigurationForceDefaults,
|
||||
"eng"
|
||||
};
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@retval EFI_ABORTED TODO: Add description for return value
|
||||
@retval EFI_SUCCESS TODO: Add description for return value
|
||||
@retval EFI_NOT_FOUND TODO: Add description for return value
|
||||
|
||||
**/
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetResponse (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_INPUT_KEY Key;
|
||||
|
||||
while (TRUE) {
|
||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (Key.ScanCode == SCAN_ESC) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
switch (Key.UnicodeChar) {
|
||||
|
||||
//
|
||||
// fall through
|
||||
//
|
||||
case L'y':
|
||||
case L'Y':
|
||||
gST->ConOut->OutputString (gST->ConOut, L"Y\n");
|
||||
return EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// fall through
|
||||
//
|
||||
case L'n':
|
||||
case L'N':
|
||||
gST->ConOut->OutputString (gST->ConOut, L"N\n");
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Allows the user to set controller specific options for a controller that a
|
||||
driver is currently managing.
|
||||
|
||||
@param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
|
||||
instance.
|
||||
@param ControllerHandle The handle of the controller to set options on.
|
||||
@param 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.
|
||||
@param 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.
|
||||
@param 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.
|
||||
|
||||
@retval EFI_SUCCESS The driver specified by This successfully set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle..
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
|
||||
valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ActionRequired is NULL.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
setting configuration options for the controller
|
||||
specified by ControllerHandle and ChildHandle.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
@retval EFI_DEVICE_ERROR A device error occurred while attempt to set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
@retval EFI_OUT_RESOURCES There are not enough resources available to set the
|
||||
configuration options for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationSetOptions (
|
||||
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 Status;
|
||||
UINT8 Value;
|
||||
UINT8 NewValue;
|
||||
UINTN DataSize;
|
||||
UINTN Index;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
*ActionRequired = EfiDriverConfigurationActionNone;
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
|
||||
gST->ConOut->OutputString (gST->ConOut, L"IDE Bus Driver Configuration\n");
|
||||
gST->ConOut->OutputString (gST->ConOut, L"===============================\n");
|
||||
|
||||
NewValue = 0;
|
||||
for (Index = 0; Index < 4; Index++) {
|
||||
gST->ConOut->OutputString (gST->ConOut, OptionString[Index]);
|
||||
|
||||
Status = GetResponse ();
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
NewValue = (UINT8) (NewValue | (1 << Index));
|
||||
}
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status) || (NewValue != Value)) {
|
||||
gRT->SetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (NewValue),
|
||||
&NewValue
|
||||
);
|
||||
|
||||
*ActionRequired = EfiDriverConfigurationActionRestartController;
|
||||
} else {
|
||||
*ActionRequired = EfiDriverConfigurationActionNone;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Tests to see if a controller's current configuration options are valid.
|
||||
|
||||
@param This A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
|
||||
instance.
|
||||
@param ControllerHandle The handle of the controller to test if it's current
|
||||
configuration options are valid.
|
||||
@param 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.
|
||||
|
||||
@retval 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.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
@retval 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
|
||||
IDEBusDriverConfigurationOptionsValid (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 Value;
|
||||
UINTN DataSize;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
DataSize = sizeof (Value);
|
||||
Status = gRT->GetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
&DataSize,
|
||||
&Value
|
||||
);
|
||||
if (EFI_ERROR (Status) || Value > 0x0f) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Forces a driver to set the default configuration options for a controller.
|
||||
|
||||
@param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
|
||||
instance.
|
||||
@param ControllerHandle The handle of the controller to force default
|
||||
configuration options on.
|
||||
@param 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.
|
||||
@param 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.
|
||||
@param ActionRequired A pointer to the action that the calling agent
|
||||
is required to perform when this function returns.
|
||||
|
||||
@retval EFI_SUCCESS The driver specified by This successfully forced
|
||||
the default configuration options on the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
|
||||
valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ActionRequired is NULL.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
forcing the default configuration options on
|
||||
the controller specified by ControllerHandle
|
||||
and ChildHandle.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the configuration type specified by DefaultType.
|
||||
@retval EFI_DEVICE_ERROR A device error occurred while attempt to force
|
||||
the default configuration options on the controller
|
||||
specified by ControllerHandle and ChildHandle.
|
||||
@retval 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
|
||||
IDEBusDriverConfigurationForceDefaults (
|
||||
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
|
||||
)
|
||||
{
|
||||
UINT8 Value;
|
||||
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Value = 0x0f;
|
||||
gRT->SetVariable (
|
||||
L"Configuration",
|
||||
&gEfiCallerIdGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (Value),
|
||||
&Value
|
||||
);
|
||||
*ActionRequired = EfiDriverConfigurationActionRestartController;
|
||||
return EFI_SUCCESS;
|
||||
}
|
200
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
Normal file
200
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
Normal file
@ -0,0 +1,200 @@
|
||||
/** @file
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "idebus.h"
|
||||
|
||||
#define IDE_BUS_DIAGNOSTIC_ERROR L"PCI IDE/ATAPI Driver Diagnostics Failed"
|
||||
|
||||
//
|
||||
// EFI Driver Diagnostics Protocol
|
||||
//
|
||||
EFI_DRIVER_DIAGNOSTICS_PROTOCOL gIDEBusDriverDiagnostics = {
|
||||
IDEBusDriverDiagnosticsRunDiagnostics,
|
||||
"eng"
|
||||
};
|
||||
|
||||
/**
|
||||
Runs diagnostics on a controller.
|
||||
|
||||
@param This A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL
|
||||
instance.
|
||||
@param ControllerHandle The handle of the controller to run diagnostics on.
|
||||
@param 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.
|
||||
@param DiagnosticType Indicates type of diagnostics to perform on the
|
||||
controller specified by ControllerHandle and ChildHandle.
|
||||
See "Related Definitions" for the list of supported
|
||||
types.
|
||||
@param 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.
|
||||
@param ErrorType A GUID that defines the format of the data returned in
|
||||
Buffer.
|
||||
@param BufferSize The size, in bytes, of the data returned in Buffer.
|
||||
@param 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().
|
||||
|
||||
@retval EFI_SUCCESS The controller specified by ControllerHandle and
|
||||
ChildHandle passed the diagnostic.
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
@retval EFI_INVALID_PARAMETER ErrorType is NULL.
|
||||
@retval EFI_INVALID_PARAMETER BufferType is NULL.
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
running diagnostics for the controller specified
|
||||
by ControllerHandle and ChildHandle.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
type of diagnostic specified by DiagnosticType.
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to complete
|
||||
the diagnostics.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to return
|
||||
the status information in ErrorType, BufferSize,
|
||||
and Buffer.
|
||||
@retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and
|
||||
ChildHandle did not pass the diagnostic.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IDEBusDriverDiagnosticsRunDiagnostics (
|
||||
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_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_BLOCK_IO_PROTOCOL *BlkIo;
|
||||
IDE_BLK_IO_DEV *IdeBlkIoDevice;
|
||||
UINT32 VendorDeviceId;
|
||||
VOID *BlockBuffer;
|
||||
|
||||
*ErrorType = NULL;
|
||||
*BufferSize = 0;
|
||||
|
||||
if (ChildHandle == NULL) {
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiCallerIdGuid,
|
||||
NULL,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **) &PciIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Use services of PCI I/O Protocol to test the PCI IDE/ATAPI Controller
|
||||
// The following test simply reads the Device ID and Vendor ID.
|
||||
// It should never fail. A real test would perform more advanced
|
||||
// diagnostics.
|
||||
//
|
||||
|
||||
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, 1, &VendorDeviceId);
|
||||
if (EFI_ERROR (Status) || VendorDeviceId == 0xffffffff) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ChildHandle,
|
||||
&gEfiBlockIoProtocolGuid,
|
||||
(VOID **) &BlkIo,
|
||||
gIDEBusDriverBinding.DriverBindingHandle,
|
||||
ChildHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlkIo);
|
||||
|
||||
//
|
||||
// Use services available from IdeBlkIoDevice to test the IDE/ATAPI device
|
||||
//
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
IdeBlkIoDevice->BlkMedia.BlockSize,
|
||||
(VOID **) &BlockBuffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = IdeBlkIoDevice->BlkIo.ReadBlocks (
|
||||
&IdeBlkIoDevice->BlkIo,
|
||||
IdeBlkIoDevice->BlkMedia.MediaId,
|
||||
0,
|
||||
IdeBlkIoDevice->BlkMedia.BlockSize,
|
||||
BlockBuffer
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
*ErrorType = &gEfiCallerIdGuid;
|
||||
*BufferSize = sizeof (IDE_BUS_DIAGNOSTIC_ERROR);
|
||||
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
(UINTN) (*BufferSize),
|
||||
(VOID **) Buffer
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
CopyMem (*Buffer, IDE_BUS_DIAGNOSTIC_ERROR, *BufferSize);
|
||||
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
gBS->FreePool (BlockBuffer);
|
||||
|
||||
return Status;
|
||||
}
|
2624
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
Normal file
2624
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
Normal file
File diff suppressed because it is too large
Load Diff
2140
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
Normal file
2140
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
Normal file
File diff suppressed because it is too large
Load Diff
1824
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
Normal file
1824
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
Normal file
File diff suppressed because it is too large
Load Diff
1328
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
Normal file
1328
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
Normal file
File diff suppressed because it is too large
Load Diff
1413
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
Normal file
1413
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
Normal file
File diff suppressed because it is too large
Load Diff
420
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
Normal file
420
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
Normal file
@ -0,0 +1,420 @@
|
||||
/** @file
|
||||
Header file for IDE Bus Driver.
|
||||
|
||||
Copyright (c) 2006 - 2007 Intel Corporation. <BR>
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _IDE_BUS_H
|
||||
#define _IDE_BUS_H
|
||||
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiDxe.h>
|
||||
#include <Common/FrameworkStatusCode.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/IdeControllerInit.h>
|
||||
#include <Protocol/BlockIo.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/DiskInfo.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PerformanceLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
|
||||
#include <IndustryStandard/pci22.h>
|
||||
#include "idedata.h"
|
||||
|
||||
//
|
||||
// Extra Definition to porting
|
||||
//
|
||||
#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define MAX_IDE_DEVICE 4
|
||||
#define MAX_IDE_CHANNELS 2
|
||||
#define MAX_IDE_DRIVES 2
|
||||
|
||||
#define INVALID_DEVICE_TYPE 0xff
|
||||
#define ATA_DEVICE_TYPE 0x00
|
||||
#define ATAPI_DEVICE_TYPE 0x01
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];
|
||||
BOOLEAN DeviceFound[MAX_IDE_DEVICE];
|
||||
BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];
|
||||
} IDE_BUS_DRIVER_PRIVATE_DATA;
|
||||
|
||||
#define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
|
||||
EFI_HANDLE Handle;
|
||||
EFI_BLOCK_IO_PROTOCOL BlkIo;
|
||||
EFI_BLOCK_IO_MEDIA BlkMedia;
|
||||
EFI_DISK_INFO_PROTOCOL DiskInfo;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
|
||||
|
||||
//
|
||||
// Local Data for IDE interface goes here
|
||||
//
|
||||
EFI_IDE_CHANNEL Channel;
|
||||
EFI_IDE_DEVICE Device;
|
||||
UINT16 Lun;
|
||||
IDE_DEVICE_TYPE Type;
|
||||
|
||||
IDE_BASE_REGISTERS *IoPort;
|
||||
UINT16 AtapiError;
|
||||
|
||||
INQUIRY_DATA *pInquiryData;
|
||||
EFI_IDENTIFY_DATA *pIdData;
|
||||
ATA_PIO_MODE PioMode;
|
||||
EFI_ATA_MODE UdmaMode;
|
||||
CHAR8 ModelName[41];
|
||||
REQUEST_SENSE_DATA *SenseData;
|
||||
UINT8 SenseDataNumber;
|
||||
UINT8 *Cache;
|
||||
|
||||
//
|
||||
// ExitBootService Event, it is used to clear pending IDE interrupt
|
||||
//
|
||||
EFI_EVENT ExitBootServiceEvent;
|
||||
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
} IDE_BLK_IO_DEV;
|
||||
|
||||
#include "ComponentName.h"
|
||||
|
||||
#define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)
|
||||
#define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;
|
||||
|
||||
#include "ide.h"
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
// Driver model protocol interface
|
||||
//
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param ImageHandle TODO: add argument description
|
||||
@param SystemTable TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusControllerDriverEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param Controller TODO: add argument description
|
||||
@param RemainingDevicePath TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param Controller TODO: add argument description
|
||||
@param RemainingDevicePath TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param Controller TODO: add argument description
|
||||
@param NumberOfChildren TODO: add argument description
|
||||
@param ChildHandleBuffer TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
;
|
||||
|
||||
//
|
||||
// EFI Driver Configuration Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationSetOptions (
|
||||
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
|
||||
IDEBusDriverConfigurationOptionsValid (
|
||||
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
IDEBusDriverConfigurationForceDefaults (
|
||||
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 Diagnostics Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
IDEBusDriverDiagnosticsRunDiagnostics (
|
||||
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
|
||||
);
|
||||
|
||||
//
|
||||
// Block I/O Protocol Interface
|
||||
//
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param ExtendedVerification TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoReset (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param MediaId TODO: add argument description
|
||||
@param LBA TODO: add argument description
|
||||
@param BufferSize TODO: add argument description
|
||||
@param Buffer TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoReadBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param MediaId TODO: add argument description
|
||||
@param LBA TODO: add argument description
|
||||
@param BufferSize TODO: add argument description
|
||||
@param Buffer TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoWriteBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEBlkIoFlushBlocks (
|
||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param PciIo TODO: add argument description
|
||||
@param Enable TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
IDERegisterDecodeEnableorDisable (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param InquiryData TODO: add argument description
|
||||
@param IntquiryDataSize TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoInquiry (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *InquiryData,
|
||||
IN OUT UINT32 *IntquiryDataSize
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param IdentifyData TODO: add argument description
|
||||
@param IdentifyDataSize TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoIdentify (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *IdentifyData,
|
||||
IN OUT UINT32 *IdentifyDataSize
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param SenseData TODO: add argument description
|
||||
@param SenseDataSize TODO: add argument description
|
||||
@param SenseDataNumber TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoSenseData (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
IN OUT VOID *SenseData,
|
||||
IN OUT UINT32 *SenseDataSize,
|
||||
OUT UINT8 *SenseDataNumber
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
TODO: Add function description
|
||||
|
||||
@param This TODO: add argument description
|
||||
@param IdeChannel TODO: add argument description
|
||||
@param IdeDevice TODO: add argument description
|
||||
|
||||
TODO: add return values
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IDEDiskInfoWhichIde (
|
||||
IN EFI_DISK_INFO_PROTOCOL *This,
|
||||
OUT UINT32 *IdeChannel,
|
||||
OUT UINT32 *IdeDevice
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
135
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.inf
Normal file
135
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.inf
Normal file
@ -0,0 +1,135 @@
|
||||
#/** @file
|
||||
# Component description file for PS2 keyboard module.
|
||||
#
|
||||
# IDE bus driver. This driver will enumerate IDE device and export the blockIo
|
||||
# protocol for every device.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = IdeBus
|
||||
FILE_GUID = 69FD8E47-A161-4550-B01A-5594CEB2B2B2
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeIdeBus
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gIDEBusDriverBinding
|
||||
# COMPONENT_NAME = gIDEBusComponentName
|
||||
# Variable Guid C Name: gConfigurationGuid Variable Name: L"Configuration"
|
||||
#
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
DriverDiagnostics.c
|
||||
DriverConfiguration.c
|
||||
ComponentName.h
|
||||
ComponentName.c
|
||||
atapi.c
|
||||
ata.c
|
||||
ide.c
|
||||
idebus.c
|
||||
idedata.h
|
||||
ide.h
|
||||
idebus.h
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/MdePkg/Include
|
||||
$(WORKSPACE)/MdeModulePkg/Include
|
||||
$(WORKSPACE)/IntelFrameworkPkg/Include
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
UefiRuntimeServicesTableLib
|
||||
UefiBootServicesTableLib
|
||||
PerformanceLib
|
||||
MemoryAllocationLib
|
||||
ReportStatusCodeLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiDiskInfoIdeInterfaceGuid # SOMETIMES_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiDiskInfoProtocolGuid # PROTOCOL BY_START
|
||||
gEfiBlockIoProtocolGuid # PROTOCOL BY_START
|
||||
gEfiIdeControllerInitProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciIoProtocolGuid # PROTOCOL TO_START
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||
|
114
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
Normal file
114
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>IdeBus</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>69FD8E47-A161-4550-B01A-5594CEB2B2B2</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for PS2 keyboard module.</Abstract>
|
||||
<Description>IDE bus driver. This driver will enumerate IDE device and export the blockIo
|
||||
protocol for every device.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>IdeBus</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>ReportStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PerformanceLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiRuntimeServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>idebus.h</Filename>
|
||||
<Filename>ide.h</Filename>
|
||||
<Filename>idedata.h</Filename>
|
||||
<Filename>idebus.c</Filename>
|
||||
<Filename>ide.c</Filename>
|
||||
<Filename>ata.c</Filename>
|
||||
<Filename>atapi.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>ComponentName.h</Filename>
|
||||
<Filename>DriverConfiguration.c</Filename>
|
||||
<Filename>DriverDiagnostics.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="1E73767F-8F52-4603-AEB4-F29B510B6766"/>
|
||||
<Package PackageGuid="2759ded5-bb57-4b06-af4f-c398fa552719"/>
|
||||
<Package PackageGuid="BA0D78D6-2CAF-414b-BD4D-B6762A894288"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiIdeControllerInitProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiDiskInfoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Variables>
|
||||
<Variable Usage="ALWAYS_CONSUMED">
|
||||
<VariableName>0x0043 0x006F 0x006E 0x0066 0x0069 0x0067 0x0075 0x0072 0x0061 0x0074 0x0069 0x006F 0x006E</VariableName>
|
||||
<GuidC_Name>gConfigurationGuid</GuidC_Name>
|
||||
</Variable>
|
||||
</Variables>
|
||||
<Guids>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiDiskInfoIdeInterfaceGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<DriverBinding>gIDEBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gIDEBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
893
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
Normal file
893
IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
Normal file
@ -0,0 +1,893 @@
|
||||
/** @file
|
||||
Header file for IDE Bus Driver's Data Structures
|
||||
|
||||
Copyright (c) 2006 - 2007 Intel Corporation. <BR>
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _IDE_DATA_H
|
||||
#define _IDE_DATA_H
|
||||
|
||||
//
|
||||
// bit definition
|
||||
//
|
||||
#define bit0 (1 << 0)
|
||||
#define bit1 (1 << 1)
|
||||
#define bit2 (1 << 2)
|
||||
#define bit3 (1 << 3)
|
||||
#define bit4 (1 << 4)
|
||||
#define bit5 (1 << 5)
|
||||
#define bit6 (1 << 6)
|
||||
#define bit7 (1 << 7)
|
||||
#define bit8 (1 << 8)
|
||||
#define bit9 (1 << 9)
|
||||
#define bit10 (1 << 10)
|
||||
#define bit11 (1 << 11)
|
||||
#define bit12 (1 << 12)
|
||||
#define bit13 (1 << 13)
|
||||
#define bit14 (1 << 14)
|
||||
#define bit15 (1 << 15)
|
||||
#define bit16 (1 << 16)
|
||||
#define bit17 (1 << 17)
|
||||
#define bit18 (1 << 18)
|
||||
#define bit19 (1 << 19)
|
||||
#define bit20 (1 << 20)
|
||||
#define bit21 (1 << 21)
|
||||
#define bit22 (1 << 22)
|
||||
#define bit23 (1 << 23)
|
||||
#define bit24 (1 << 24)
|
||||
#define bit25 (1 << 25)
|
||||
#define bit26 (1 << 26)
|
||||
#define bit27 (1 << 27)
|
||||
#define bit28 (1 << 28)
|
||||
#define bit29 (1 << 29)
|
||||
#define bit30 (1 << 30)
|
||||
#define bit31 (1 << 31)
|
||||
|
||||
//
|
||||
// common constants
|
||||
//
|
||||
#define STALL_1_MILLI_SECOND 1000 // stall 1 ms
|
||||
#define STALL_1_SECOND 1000000 // stall 1 second
|
||||
typedef enum {
|
||||
IdePrimary = 0,
|
||||
IdeSecondary = 1,
|
||||
IdeMaxChannel = 2
|
||||
} EFI_IDE_CHANNEL;
|
||||
|
||||
typedef enum {
|
||||
IdeMaster = 0,
|
||||
IdeSlave = 1,
|
||||
IdeMaxDevice = 2
|
||||
} EFI_IDE_DEVICE;
|
||||
|
||||
typedef enum {
|
||||
IdeMagnetic, /* ZIP Drive or LS120 Floppy Drive */
|
||||
IdeCdRom, /* ATAPI CDROM */
|
||||
IdeHardDisk, /* Hard Disk */
|
||||
Ide48bitAddressingHardDisk, /* Hard Disk larger than 120GB */
|
||||
IdeUnknown
|
||||
} IDE_DEVICE_TYPE;
|
||||
|
||||
typedef enum {
|
||||
SenseNoSenseKey,
|
||||
SenseDeviceNotReadyNoRetry,
|
||||
SenseDeviceNotReadyNeedRetry,
|
||||
SenseNoMedia,
|
||||
SenseMediaChange,
|
||||
SenseMediaError,
|
||||
SenseOtherSense
|
||||
} SENSE_RESULT;
|
||||
|
||||
typedef enum {
|
||||
AtaUdmaReadOp,
|
||||
AtaUdmaReadExtOp,
|
||||
AtaUdmaWriteOp,
|
||||
AtaUdmaWriteExtOp
|
||||
} ATA_UDMA_OPERATION;
|
||||
|
||||
//
|
||||
// IDE Registers
|
||||
//
|
||||
typedef union {
|
||||
UINT16 Command; /* when write */
|
||||
UINT16 Status; /* when read */
|
||||
} IDE_CMD_OR_STATUS;
|
||||
|
||||
typedef union {
|
||||
UINT16 Error; /* when read */
|
||||
UINT16 Feature; /* when write */
|
||||
} IDE_ERROR_OR_FEATURE;
|
||||
|
||||
typedef union {
|
||||
UINT16 AltStatus; /* when read */
|
||||
UINT16 DeviceControl; /* when write */
|
||||
} IDE_AltStatus_OR_DeviceControl;
|
||||
|
||||
//
|
||||
// IDE registers set
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 Data;
|
||||
IDE_ERROR_OR_FEATURE Reg1;
|
||||
UINT16 SectorCount;
|
||||
UINT16 SectorNumber;
|
||||
UINT16 CylinderLsb;
|
||||
UINT16 CylinderMsb;
|
||||
UINT16 Head;
|
||||
IDE_CMD_OR_STATUS Reg;
|
||||
|
||||
IDE_AltStatus_OR_DeviceControl Alt;
|
||||
UINT16 DriveAddress;
|
||||
|
||||
UINT16 MasterSlave;
|
||||
UINT16 BusMasterBaseAddr;
|
||||
} IDE_BASE_REGISTERS;
|
||||
|
||||
//
|
||||
// IDE registers' base addresses
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 CommandBlockBaseAddr;
|
||||
UINT16 ControlBlockBaseAddr;
|
||||
UINT16 BusMasterBaseAddr;
|
||||
} IDE_REGISTERS_BASE_ADDR;
|
||||
|
||||
//
|
||||
// Bit definitions in Programming Interface byte of the Class Code field
|
||||
// in PCI IDE controller's Configuration Space
|
||||
//
|
||||
#define IDE_PRIMARY_OPERATING_MODE bit0
|
||||
#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR bit1
|
||||
#define IDE_SECONDARY_OPERATING_MODE bit2
|
||||
#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR bit3
|
||||
|
||||
//
|
||||
// IDE registers bit definitions
|
||||
//
|
||||
|
||||
//
|
||||
// Err Reg
|
||||
//
|
||||
#define BBK_ERR bit7 /* Bad block detected */
|
||||
#define UNC_ERR bit6 /* Uncorrectable Data */
|
||||
#define MC_ERR bit5 /* Media Change */
|
||||
#define IDNF_ERR bit4 /* ID Not Found */
|
||||
#define MCR_ERR bit3 /* Media Change Requested */
|
||||
#define ABRT_ERR bit2 /* Aborted Command */
|
||||
#define TK0NF_ERR bit1 /* Track 0 Not Found */
|
||||
#define AMNF_ERR bit0 /* Address Mark Not Found */
|
||||
|
||||
//
|
||||
// Device/Head Reg
|
||||
//
|
||||
#define LBA_MODE bit6
|
||||
#define DEV bit4
|
||||
#define HS3 bit3
|
||||
#define HS2 bit2
|
||||
#define HS1 bit1
|
||||
#define HS0 bit0
|
||||
#define CHS_MODE (0)
|
||||
#define DRV0 (0)
|
||||
#define DRV1 (1)
|
||||
#define MST_DRV DRV0
|
||||
#define SLV_DRV DRV1
|
||||
|
||||
//
|
||||
// Status Reg
|
||||
//
|
||||
#define BSY bit7 /* Controller Busy */
|
||||
#define DRDY bit6 /* Drive Ready */
|
||||
#define DWF bit5 /* Drive Write Fault */
|
||||
#define DSC bit4 /* Disk Seek Complete */
|
||||
#define DRQ bit3 /* Data Request */
|
||||
#define CORR bit2 /* Corrected Data */
|
||||
#define IDX bit1 /* Index */
|
||||
#define ERR bit0 /* Error */
|
||||
|
||||
//
|
||||
// Device Control Reg
|
||||
//
|
||||
#define SRST bit2 /* Software Reset */
|
||||
#define IEN_L bit1 /* Interrupt Enable #*/
|
||||
|
||||
//
|
||||
// Bus Master Reg
|
||||
//
|
||||
#define BMIC_nREAD bit3
|
||||
#define BMIC_START bit0
|
||||
#define BMIS_INTERRUPT bit2
|
||||
#define BMIS_ERROR bit1
|
||||
|
||||
#define BMICP_OFFSET 0x00
|
||||
#define BMISP_OFFSET 0x02
|
||||
#define BMIDP_OFFSET 0x04
|
||||
#define BMICS_OFFSET 0x08
|
||||
#define BMISS_OFFSET 0x0A
|
||||
#define BMIDS_OFFSET 0x0C
|
||||
|
||||
//
|
||||
// Time Out Value For IDE Device Polling
|
||||
//
|
||||
|
||||
//
|
||||
// ATATIMEOUT is used for waiting time out for ATA device
|
||||
//
|
||||
|
||||
//
|
||||
// 1 second
|
||||
//
|
||||
#define ATATIMEOUT 1000
|
||||
|
||||
//
|
||||
// ATAPITIMEOUT is used for waiting operation
|
||||
// except read and write time out for ATAPI device
|
||||
//
|
||||
|
||||
//
|
||||
// 1 second
|
||||
//
|
||||
#define ATAPITIMEOUT 1000
|
||||
|
||||
//
|
||||
// ATAPILONGTIMEOUT is used for waiting read and
|
||||
// write operation timeout for ATAPI device
|
||||
//
|
||||
|
||||
//
|
||||
// 2 seconds
|
||||
//
|
||||
#define CDROMLONGTIMEOUT 2000
|
||||
|
||||
//
|
||||
// 5 seconds
|
||||
//
|
||||
#define ATAPILONGTIMEOUT 5000
|
||||
|
||||
//
|
||||
// 10 seconds
|
||||
//
|
||||
#define ATASMARTTIMEOUT 10000
|
||||
|
||||
//
|
||||
// ATA Commands Code
|
||||
//
|
||||
#define ATA_INITIALIZE_DEVICE 0x91
|
||||
|
||||
//
|
||||
// Class 1
|
||||
//
|
||||
#define IDENTIFY_DRIVE_CMD 0xec
|
||||
#define READ_BUFFER_CMD 0xe4
|
||||
#define READ_SECTORS_CMD 0x20
|
||||
#define READ_SECTORS_WITH_RETRY_CMD 0x21
|
||||
#define READ_LONG_CMD 0x22
|
||||
#define READ_LONG_WITH_RETRY_CMD 0x23
|
||||
//
|
||||
// Class 1 - Atapi6 enhanced commands
|
||||
//
|
||||
#define READ_SECTORS_EXT_CMD 0x24
|
||||
|
||||
//
|
||||
// Class 2
|
||||
//
|
||||
#define FORMAT_TRACK_CMD 0x50
|
||||
#define WRITE_BUFFER_CMD 0xe8
|
||||
#define WRITE_SECTORS_CMD 0x30
|
||||
#define WRITE_SECTORS_WITH_RETRY_CMD 0x31
|
||||
#define WRITE_LONG_CMD 0x32
|
||||
#define WRITE_LONG_WITH_RETRY_CMD 0x33
|
||||
#define WRITE_VERIFY_CMD 0x3c
|
||||
//
|
||||
// Class 2 - Atapi6 enhanced commands
|
||||
//
|
||||
#define WRITE_SECTORS_EXT_CMD 0x34
|
||||
|
||||
//
|
||||
// Class 3
|
||||
//
|
||||
#define ACK_MEDIA_CHANGE_CMD 0xdb
|
||||
#define BOOT_POST_BOOT_CMD 0xdc
|
||||
#define BOOT_PRE_BOOT_CMD 0xdd
|
||||
#define CHECK_POWER_MODE_CMD 0x98
|
||||
#define CHECK_POWER_MODE_CMD_ALIAS 0xe5
|
||||
#define DOOR_LOCK_CMD 0xde
|
||||
#define DOOR_UNLOCK_CMD 0xdf
|
||||
#define EXEC_DRIVE_DIAG_CMD 0x90
|
||||
#define IDLE_CMD_ALIAS 0x97
|
||||
#define IDLE_CMD 0xe3
|
||||
#define IDLE_IMMEDIATE_CMD 0x95
|
||||
#define IDLE_IMMEDIATE_CMD_ALIAS 0xe1
|
||||
#define INIT_DRIVE_PARAM_CMD 0x91
|
||||
#define RECALIBRATE_CMD 0x10 /* aliased to 1x */
|
||||
#define READ_DRIVE_STATE_CMD 0xe9
|
||||
#define SET_MULTIPLE_MODE_CMD 0xC6
|
||||
#define READ_DRIVE_STATE_CMD 0xe9
|
||||
#define READ_VERIFY_CMD 0x40
|
||||
#define READ_VERIFY_WITH_RETRY_CMD 0x41
|
||||
#define SEEK_CMD 0x70 /* aliased to 7x */
|
||||
#define SET_FEATURES_CMD 0xef
|
||||
#define STANDBY_CMD 0x96
|
||||
#define STANDBY_CMD_ALIAS 0xe2
|
||||
#define STANDBY_IMMEDIATE_CMD 0x94
|
||||
#define STANDBY_IMMEDIATE_CMD_ALIAS 0xe0
|
||||
|
||||
//
|
||||
// Class 4
|
||||
//
|
||||
#define READ_DMA_CMD 0xc8
|
||||
#define READ_DMA_WITH_RETRY_CMD 0xc9
|
||||
#define READ_DMA_EXT_CMD 0x25
|
||||
#define WRITE_DMA_CMD 0xca
|
||||
#define WRITE_DMA_WITH_RETRY_CMD 0xcb
|
||||
#define WRITE_DMA_EXT_CMD 0x35
|
||||
|
||||
//
|
||||
// Class 5
|
||||
//
|
||||
#define READ_MULTIPLE_CMD 0xc4
|
||||
#define REST_CMD 0xe7
|
||||
#define RESTORE_DRIVE_STATE_CMD 0xea
|
||||
#define SET_SLEEP_MODE_CMD 0x99
|
||||
#define SET_SLEEP_MODE_CMD_ALIAS 0xe6
|
||||
#define WRITE_MULTIPLE_CMD 0xc5
|
||||
#define WRITE_SAME_CMD 0xe9
|
||||
|
||||
//
|
||||
// Class 6 - Host protected area access feature set
|
||||
//
|
||||
#define READ_NATIVE_MAX_ADDRESS_CMD 0xf8
|
||||
#define SET_MAX_ADDRESS_CMD 0xf9
|
||||
|
||||
//
|
||||
// Class 6 - ATA/ATAPI-6 enhanced commands
|
||||
//
|
||||
#define READ_NATIVE_MAX_ADDRESS_EXT_CMD 0x27
|
||||
#define SET_MAX_ADDRESS_CMD_EXT 0x37
|
||||
|
||||
//
|
||||
// Class 6 - SET_MAX related sub command (in feature register)
|
||||
//
|
||||
#define PARTIES_SET_MAX_ADDRESS_SUB_CMD 0x00
|
||||
#define PARTIES_SET_PASSWORD_SUB_CMD 0x01
|
||||
#define PARTIES_LOCK_SUB_CMD 0x02
|
||||
#define PARTIES_UNLOCK_SUB_CMD 0x03
|
||||
#define PARTIES_FREEZE_SUB_CMD 0x04
|
||||
|
||||
//
|
||||
// S.M.A.R.T
|
||||
//
|
||||
#define ATA_SMART_CMD 0xb0
|
||||
#define ATA_CONSTANT_C2 0xc2
|
||||
#define ATA_CONSTANT_4F 0x4f
|
||||
#define ATA_SMART_ENABLE_OPERATION 0xd8
|
||||
#define ATA_SMART_RETURN_STATUS 0xda
|
||||
|
||||
//
|
||||
// Error codes for Exec Drive Diag
|
||||
//
|
||||
#define DRIV_DIAG_NO_ERROR (0x01)
|
||||
#define DRIV_DIAG_FORMATTER_ERROR (0x02)
|
||||
#define DRIV_DIAG_DATA_BUFFER_ERROR (0x03)
|
||||
#define DRIV_DIAG_ECC_CKT_ERRROR (0x04)
|
||||
#define DRIV_DIAG_UP_ERROR (0x05)
|
||||
#define DRIV_DIAG_SLAVE_DRV_ERROR (0x80) /* aliased to 0x8x */
|
||||
|
||||
//
|
||||
// Codes for Format Track
|
||||
//
|
||||
#define FORMAT_GOOD_SECTOR (0x00)
|
||||
#define FORMAT_SUSPEND_ALLOC (0x01)
|
||||
#define FORMAT_REALLOC_SECTOR (0x02)
|
||||
#define FORMAT_MARK_SECTOR_DEFECTIVE (0x03)
|
||||
|
||||
//
|
||||
// IDE_IDENTIFY bits
|
||||
// config bits :
|
||||
//
|
||||
#define ID_CONFIG_RESERVED0 bit0
|
||||
#define ID_CONFIG_HARD_SECTORED_DRIVE bit1
|
||||
#define ID_CONFIG_SOFT_SECTORED_DRIVE bit2
|
||||
#define ID_CONFIG_NON_MFM bit3
|
||||
#define ID_CONFIG_15uS_HEAD_SWITCHING bit4
|
||||
#define ID_CONFIG_SPINDLE_MOTOR_CONTROL bit5
|
||||
#define ID_CONFIG_HARD_DRIVE bit6
|
||||
#define ID_CONFIG_CHANGEABLE_MEDIUM bit7
|
||||
#define ID_CONFIG_DATA_RATE_TO_5MHZ bit8
|
||||
#define ID_CONFIG_DATA_RATE_5_TO_10MHZ bit9
|
||||
#define ID_CONFIG_DATA_RATE_ABOVE_10MHZ bit10
|
||||
#define ID_CONFIG_MOTOR_SPEED_TOLERANCE_ABOVE_0_5_PERC bit11
|
||||
#define ID_CONFIG_DATA_CLK_OFFSET_AVAIL bit12
|
||||
#define ID_CONFIG_TRACK_OFFSET_AVAIL bit13
|
||||
#define ID_CONFIG_SPEED_TOLERANCE_GAP_NECESSARY bit14
|
||||
#define ID_CONFIG_RESERVED1 bit15
|
||||
|
||||
#define ID_DOUBLE_WORD_IO_POSSIBLE bit01
|
||||
#define ID_LBA_SUPPORTED bit9
|
||||
#define ID_DMA_SUPPORTED bit8
|
||||
|
||||
#define SET_FEATURE_ENABLE_8BIT_TRANSFER (0x01)
|
||||
#define SET_FEATURE_ENABLE_WRITE_CACHE (0x02)
|
||||
#define SET_FEATURE_TRANSFER_MODE (0x03)
|
||||
#define SET_FEATURE_WRITE_SAME_WRITE_SPECIFIC_AREA (0x22)
|
||||
#define SET_FEATURE_DISABLE_RETRIES (0x33)
|
||||
//
|
||||
// for Read & Write Longs
|
||||
//
|
||||
#define SET_FEATURE_VENDOR_SPEC_ECC_LENGTH (0x44)
|
||||
#define SET_FEATURE_PLACE_NO_OF_CACHE_SEGMENTS_IN_SECTOR_NO_REG (0x54)
|
||||
#define SET_FEATURE_DISABLE_READ_AHEAD (0x55)
|
||||
#define SET_FEATURE_MAINTAIN_PARAM_AFTER_RESET (0x66)
|
||||
#define SET_FEATURE_DISABLE_ECC (0x77)
|
||||
#define SET_FEATURE_DISABLE_8BIT_TRANSFER (0x81)
|
||||
#define SET_FEATURE_DISABLE_WRITE_CACHE (0x82)
|
||||
#define SET_FEATURE_ENABLE_ECC (0x88)
|
||||
#define SET_FEATURE_ENABLE_RETRIES (0x99)
|
||||
#define SET_FEATURE_ENABLE_READ_AHEAD (0xaa)
|
||||
#define SET_FEATURE_SET_SECTOR_CNT_REG_AS_NO_OF_READ_AHEAD_SECTORS (0xab)
|
||||
#define SET_FEATURE_ALLOW_REST_MODE (0xac)
|
||||
//
|
||||
// for Read & Write Longs
|
||||
//
|
||||
#define SET_FEATURE_4BYTE_ECC (0xbb)
|
||||
#define SET_FEATURE_DEFALUT_FEATURES_ON_SOFTWARE_RESET (0xcc)
|
||||
#define SET_FEATURE_WRITE_SAME_TO_WRITE_ENTIRE_MEDIUM (0xdd)
|
||||
|
||||
#define BLOCK_TRANSFER_MODE (0x00)
|
||||
#define SINGLE_WORD_DMA_TRANSFER_MODE (0x10)
|
||||
#define MULTI_WORD_DMA_TRANSFER_MODE (0x20)
|
||||
#define TRANSFER_MODE_MASK (0x07) // 3 LSBs
|
||||
|
||||
//
|
||||
// Drive 0 - Head 0
|
||||
//
|
||||
#define DEFAULT_DRIVE (0x00)
|
||||
#define DEFAULT_CMD (0xa0)
|
||||
//
|
||||
// default content of device control register, disable INT
|
||||
//
|
||||
#define DEFAULT_CTL (0x0a)
|
||||
#define DEFAULT_IDE_BM_IO_BASE_ADR (0xffa0)
|
||||
|
||||
//
|
||||
// ATAPI6 related data structure definition
|
||||
//
|
||||
|
||||
//
|
||||
// The maximum sectors count in 28 bit addressing mode
|
||||
//
|
||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||
|
||||
//
|
||||
// Move the IDENTIFY section to DXE\Protocol\IdeControllerInit
|
||||
//
|
||||
|
||||
//
|
||||
// ATAPI Command
|
||||
//
|
||||
#define ATAPI_SOFT_RESET_CMD 0x08
|
||||
#define ATAPI_PACKET_CMD 0xA0
|
||||
#define PACKET_CMD 0xA0
|
||||
#define ATAPI_IDENTIFY_DEVICE_CMD 0xA1
|
||||
#define ATAPI_SERVICE_CMD 0xA2
|
||||
|
||||
//
|
||||
// ATAPI Packet Command
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} TEST_UNIT_READY_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 page_code;
|
||||
UINT8 reserved_3;
|
||||
UINT8 allocation_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} INQUIRY_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 allocation_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 reserved_8;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} REQUEST_SENSE_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 4;
|
||||
UINT8 lun : 4;
|
||||
UINT8 page_code : 4;
|
||||
UINT8 page_control : 4;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 parameter_list_length_hi;
|
||||
UINT8 parameter_list_length_lo;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} MODE_SENSE_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1 : 5;
|
||||
UINT8 lun : 3;
|
||||
UINT8 Lba0;
|
||||
UINT8 Lba1;
|
||||
UINT8 Lba2;
|
||||
UINT8 Lba3;
|
||||
UINT8 reserved_6;
|
||||
UINT8 TranLen0;
|
||||
UINT8 TranLen1;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} READ10_CMD;
|
||||
|
||||
typedef struct {
|
||||
UINT8 opcode;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 reserved_3;
|
||||
UINT8 reserved_4;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 allocation_length_hi;
|
||||
UINT8 allocation_length_lo;
|
||||
UINT8 reserved_9;
|
||||
UINT8 reserved_10;
|
||||
UINT8 reserved_11;
|
||||
} READ_FORMAT_CAP_CMD;
|
||||
|
||||
typedef union {
|
||||
UINT16 Data16[6];
|
||||
TEST_UNIT_READY_CMD TestUnitReady;
|
||||
READ10_CMD Read10;
|
||||
REQUEST_SENSE_CMD RequestSence;
|
||||
INQUIRY_CMD Inquiry;
|
||||
MODE_SENSE_CMD ModeSense;
|
||||
READ_FORMAT_CAP_CMD ReadFormatCapacity;
|
||||
} ATAPI_PACKET_COMMAND;
|
||||
|
||||
typedef struct {
|
||||
UINT32 RegionBaseAddr;
|
||||
UINT16 ByteCount;
|
||||
UINT16 EndOfTable;
|
||||
} IDE_DMA_PRD;
|
||||
|
||||
#define MAX_DMA_EXT_COMMAND_SECTORS 0x10000
|
||||
#define MAX_DMA_COMMAND_SECTORS 0x100
|
||||
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// Packet Command Code
|
||||
//
|
||||
#define TEST_UNIT_READY 0x00
|
||||
#define REZERO 0x01
|
||||
#define REQUEST_SENSE 0x03
|
||||
#define FORMAT_UNIT 0x04
|
||||
#define REASSIGN_BLOCKS 0x07
|
||||
#define INQUIRY 0x12
|
||||
#define START_STOP_UNIT 0x1B
|
||||
#define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
|
||||
#define READ_FORMAT_CAPACITY 0x23
|
||||
#define OLD_FORMAT_UNIT 0x24
|
||||
#define READ_CAPACITY 0x25
|
||||
#define READ_10 0x28
|
||||
#define WRITE_10 0x2A
|
||||
#define SEEK 0x2B
|
||||
#define SEND_DIAGNOSTICS 0x3D
|
||||
#define WRITE_VERIFY 0x2E
|
||||
#define VERIFY 0x2F
|
||||
#define READ_DEFECT_DATA 0x37
|
||||
#define WRITE_BUFFER 0x38
|
||||
#define READ_BUFFER 0x3C
|
||||
#define READ_LONG 0x3E
|
||||
#define WRITE_LONG 0x3F
|
||||
#define MODE_SELECT 0x55
|
||||
#define MODE_SENSE 0x5A
|
||||
#define READ_12 0xA8
|
||||
#define WRITE_12 0xAA
|
||||
#define MAX_ATAPI_BYTE_COUNT (0xfffe)
|
||||
|
||||
//
|
||||
// Sense Key
|
||||
//
|
||||
#define REQUEST_SENSE_ERROR (0x70)
|
||||
#define SK_NO_SENSE (0x0)
|
||||
#define SK_RECOVERY_ERROR (0x1)
|
||||
#define SK_NOT_READY (0x2)
|
||||
#define SK_MEDIUM_ERROR (0x3)
|
||||
#define SK_HARDWARE_ERROR (0x4)
|
||||
#define SK_ILLEGAL_REQUEST (0x5)
|
||||
#define SK_UNIT_ATTENTION (0x6)
|
||||
#define SK_DATA_PROTECT (0x7)
|
||||
#define SK_BLANK_CHECK (0x8)
|
||||
#define SK_VENDOR_SPECIFIC (0x9)
|
||||
#define SK_RESERVED_A (0xA)
|
||||
#define SK_ABORT (0xB)
|
||||
#define SK_RESERVED_C (0xC)
|
||||
#define SK_OVERFLOW (0xD)
|
||||
#define SK_MISCOMPARE (0xE)
|
||||
#define SK_RESERVED_F (0xF)
|
||||
|
||||
//
|
||||
// Additional Sense Codes
|
||||
//
|
||||
#define ASC_NOT_READY (0x04)
|
||||
#define ASC_MEDIA_ERR1 (0x10)
|
||||
#define ASC_MEDIA_ERR2 (0x11)
|
||||
#define ASC_MEDIA_ERR3 (0x14)
|
||||
#define ASC_MEDIA_ERR4 (0x30)
|
||||
#define ASC_MEDIA_UPSIDE_DOWN (0x06)
|
||||
#define ASC_INVALID_CMD (0x20)
|
||||
#define ASC_LBA_OUT_OF_RANGE (0x21)
|
||||
#define ASC_INVALID_FIELD (0x24)
|
||||
#define ASC_WRITE_PROTECTED (0x27)
|
||||
#define ASC_MEDIA_CHANGE (0x28)
|
||||
#define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
|
||||
#define ASC_ILLEGAL_FIELD (0x26)
|
||||
#define ASC_NO_MEDIA (0x3A)
|
||||
#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
|
||||
|
||||
//
|
||||
// Additional Sense Code Qualifier
|
||||
//
|
||||
#define ASCQ_IN_PROGRESS (0x01)
|
||||
|
||||
#define SETFEATURE TRUE
|
||||
#define CLEARFEATURE FALSE
|
||||
|
||||
//
|
||||
// ATAPI Data structure
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 peripheral_type;
|
||||
UINT8 RMB;
|
||||
UINT8 version;
|
||||
UINT8 response_data_format;
|
||||
UINT8 addnl_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 vendor_info[8];
|
||||
UINT8 product_id[12];
|
||||
UINT8 eeprom_product_code[4];
|
||||
UINT8 firmware_rev_level[4];
|
||||
UINT8 firmware_sub_rev_level[1];
|
||||
UINT8 reserved_37;
|
||||
UINT8 reserved_38;
|
||||
UINT8 reserved_39;
|
||||
UINT8 max_capacity_hi;
|
||||
UINT8 max_capacity_mid;
|
||||
UINT8 max_capacity_lo;
|
||||
UINT8 reserved_43_95[95 - 43 + 1];
|
||||
} INQUIRY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 peripheral_type;
|
||||
UINT8 RMB;
|
||||
UINT8 version;
|
||||
UINT8 response_data_format;
|
||||
UINT8 addnl_length;
|
||||
UINT8 reserved_5;
|
||||
UINT8 reserved_6;
|
||||
UINT8 reserved_7;
|
||||
UINT8 vendor_info[8];
|
||||
UINT8 product_id[16];
|
||||
UINT8 product_revision_level[4];
|
||||
UINT8 vendor_specific[20];
|
||||
UINT8 reserved_56_95[40];
|
||||
} CDROM_INQUIRY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 error_code : 7;
|
||||
UINT8 valid : 1;
|
||||
UINT8 reserved_1;
|
||||
UINT8 sense_key : 4;
|
||||
UINT8 reserved_21 : 1;
|
||||
UINT8 ILI : 1;
|
||||
UINT8 reserved_22 : 2;
|
||||
UINT8 vendor_specific_3;
|
||||
UINT8 vendor_specific_4;
|
||||
UINT8 vendor_specific_5;
|
||||
UINT8 vendor_specific_6;
|
||||
UINT8 addnl_sense_length; // n - 7
|
||||
UINT8 vendor_specific_8;
|
||||
UINT8 vendor_specific_9;
|
||||
UINT8 vendor_specific_10;
|
||||
UINT8 vendor_specific_11;
|
||||
UINT8 addnl_sense_code; // mandatory
|
||||
UINT8 addnl_sense_code_qualifier; // mandatory
|
||||
UINT8 field_replaceable_unit_code; // optional
|
||||
UINT8 reserved_15;
|
||||
UINT8 reserved_16;
|
||||
UINT8 reserved_17;
|
||||
//
|
||||
// Followed by additional sense bytes : FIXME
|
||||
//
|
||||
} REQUEST_SENSE_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 LastLba3;
|
||||
UINT8 LastLba2;
|
||||
UINT8 LastLba1;
|
||||
UINT8 LastLba0;
|
||||
UINT8 BlockSize3;
|
||||
UINT8 BlockSize2;
|
||||
UINT8 BlockSize1;
|
||||
UINT8 BlockSize0;
|
||||
} READ_CAPACITY_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT8 reserved_0;
|
||||
UINT8 reserved_1;
|
||||
UINT8 reserved_2;
|
||||
UINT8 Capacity_Length;
|
||||
UINT8 LastLba3;
|
||||
UINT8 LastLba2;
|
||||
UINT8 LastLba1;
|
||||
UINT8 LastLba0;
|
||||
UINT8 DesCode : 2;
|
||||
UINT8 reserved_9 : 6;
|
||||
UINT8 BlockSize2;
|
||||
UINT8 BlockSize1;
|
||||
UINT8 BlockSize0;
|
||||
} READ_FORMAT_CAPACITY_DATA;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// PIO mode definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_PIO_MODE_BELOW_2,
|
||||
ATA_PIO_MODE_2,
|
||||
ATA_PIO_MODE_3,
|
||||
ATA_PIO_MODE_4
|
||||
} ATA_PIO_MODE;
|
||||
|
||||
//
|
||||
// Multi word DMA definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_MDMA_MODE_0,
|
||||
ATA_MDMA_MODE_1,
|
||||
ATA_MDMA_MODE_2
|
||||
} ATA_MDMA_MODE;
|
||||
|
||||
//
|
||||
// UDMA mode definition
|
||||
//
|
||||
typedef enum {
|
||||
ATA_UDMA_MODE_0,
|
||||
ATA_UDMA_MODE_1,
|
||||
ATA_UDMA_MODE_2,
|
||||
ATA_UDMA_MODE_3,
|
||||
ATA_UDMA_MODE_4,
|
||||
ATA_UDMA_MODE_5
|
||||
} ATA_UDMA_MODE;
|
||||
|
||||
#define ATA_MODE_CATEGORY_DEFAULT_PIO 0x00
|
||||
#define ATA_MODE_CATEGORY_FLOW_PIO 0x01
|
||||
#define ATA_MODE_CATEGORY_MDMA 0x04
|
||||
#define ATA_MODE_CATEGORY_UDMA 0x08
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 ModeNumber : 3;
|
||||
UINT8 ModeCategory : 5;
|
||||
} ATA_TRANSFER_MODE;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Sector;
|
||||
UINT8 Heads;
|
||||
UINT8 MultipleSector;
|
||||
} ATA_DRIVE_PARMS;
|
||||
|
||||
#pragma pack()
|
||||
//
|
||||
// IORDY Sample Point field value
|
||||
//
|
||||
#define ISP_5_CLK 0
|
||||
#define ISP_4_CLK 1
|
||||
#define ISP_3_CLK 2
|
||||
#define ISP_2_CLK 3
|
||||
|
||||
//
|
||||
// Recovery Time field value
|
||||
//
|
||||
#define RECVY_4_CLK 0
|
||||
#define RECVY_3_CLK 1
|
||||
#define RECVY_2_CLK 2
|
||||
#define RECVY_1_CLK 3
|
||||
|
||||
//
|
||||
// Slave IDE Timing Register Enable
|
||||
//
|
||||
#define SITRE bit14
|
||||
|
||||
//
|
||||
// DMA Timing Enable Only Select 1
|
||||
//
|
||||
#define DTE1 bit7
|
||||
|
||||
//
|
||||
// Pre-fetch and Posting Enable Select 1
|
||||
//
|
||||
#define PPE1 bit6
|
||||
|
||||
//
|
||||
// IORDY Sample Point Enable Select 1
|
||||
//
|
||||
#define IE1 bit5
|
||||
|
||||
//
|
||||
// Fast Timing Bank Drive Select 1
|
||||
//
|
||||
#define TIME1 bit4
|
||||
|
||||
//
|
||||
// DMA Timing Enable Only Select 0
|
||||
//
|
||||
#define DTE0 bit3
|
||||
|
||||
//
|
||||
// Pre-fetch and Posting Enable Select 0
|
||||
//
|
||||
#define PPE0 bit2
|
||||
|
||||
//
|
||||
// IOREY Sample Point Enable Select 0
|
||||
//
|
||||
#define IE0 bit1
|
||||
|
||||
//
|
||||
// Fast Timing Bank Drive Select 0
|
||||
//
|
||||
#define TIME0 bit0
|
||||
|
||||
#endif
|
133
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c
Normal file
133
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName = {
|
||||
PciBusComponentNameGetDriverName,
|
||||
PciBusComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = {
|
||||
{ "eng", (CHAR16 *) L"PCI Bus Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetDriverName (
|
||||
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,
|
||||
gPciBusComponentName.SupportedLanguages,
|
||||
mPciBusDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetControllerName (
|
||||
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;
|
||||
}
|
87
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
Normal file
87
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_BUS_COMPONENT_NAME_H
|
||||
#define _EFI_PCI_BUS_COMPONENT_NAME_H
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
DriverName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
ControllerHandle - TODO: add argument description
|
||||
ChildHandle - TODO: add argument description
|
||||
Language - TODO: add argument description
|
||||
ControllerName - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
172
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.inf
Normal file
172
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.inf
Normal file
@ -0,0 +1,172 @@
|
||||
#/** @file
|
||||
# Component description file for PciBus module.
|
||||
#
|
||||
# PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO
|
||||
# space for these devices. Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
|
||||
# support hot plug.
|
||||
# Copyright (c) 2006 - 2007, Intel Corporation
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PciBus
|
||||
FILE_GUID = 93B80004-9FB3-11d4-9A3A-0090273FC14D
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = PciBusEntryPoint
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gPciBusDriverBinding
|
||||
# COMPONENT_NAME = gPciBusComponentName
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
PciLib.c
|
||||
PciIo.c
|
||||
pcibus.c
|
||||
PciDeviceSupport.c
|
||||
ComponentName.c
|
||||
ComponentName.h
|
||||
PciCommand.c
|
||||
PciResourceSupport.c
|
||||
PciEnumeratorSupport.c
|
||||
PciEnumerator.c
|
||||
PciOptionRomSupport.c
|
||||
PciDriverOverride.c
|
||||
PciPowerManagement.c
|
||||
PciPowerManagement.h
|
||||
PciDriverOverride.h
|
||||
PciRomTable.c
|
||||
PciHotPlugSupport.c
|
||||
PciLib.h
|
||||
PciHotPlugSupport.h
|
||||
PciRomTable.h
|
||||
PciOptionRomSupport.h
|
||||
PciEnumeratorSupport.h
|
||||
PciEnumerator.h
|
||||
PciResourceSupport.h
|
||||
PciDeviceSupport.h
|
||||
PciCommand.h
|
||||
PciIo.h
|
||||
pcibus.h
|
||||
|
||||
[Includes]
|
||||
IntelFrameworkModulePkg/Include
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
IntelFrameworkPkg/IntelFrameworkPkg.dec
|
||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
PciIncompatibleDeviceSupportLib
|
||||
PcdLib
|
||||
DevicePathLib
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
ReportStatusCodeLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiPciOptionRomTableGuid # SOMETIMES_CONSUMED System Table
|
||||
gEfiUgaIoProtocolGuid # ALWAYS_CONSUMED System Table
|
||||
gEfiPciHotplugDeviceGuid # PRIVATE
|
||||
gEfiPciOptionRomTableGuid # SOMETIMES_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiPciHotPlugRequestProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL BY_START
|
||||
gEfiPciIoProtocolGuid # PROTOCOL BY_START
|
||||
gEfiLoadedImageProtocolGuid # PROTOCOL TO_START
|
||||
gEfiDecompressProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciHotPlugInitProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciHostBridgeResourceAllocationProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciPlatformProtocolGuid # PROTOCOL TO_START
|
||||
gEfiPciRootBridgeIoProtocolGuid # PROTOCOL TO_START
|
||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd FEATURE_FLAG - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsFeatureFlag.common]
|
||||
PcdPciVgaEnable|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdPciBusHotplugDeviceSupport|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
PcdPciIsaEnable|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd FIXED_AT_BUILD - list of PCDs that this module is coded for.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
PcdPciIncompatibleDeviceSupportMask|gEfiIntelFrameworkModulePkgTokenSpaceGuid
|
||||
|
178
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
Normal file
178
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
Normal file
@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>PciBus</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>93B80004-9FB3-11d4-9A3A-0090273FC14D</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component description file for PciBus module.</Abstract>
|
||||
<Description>PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO
|
||||
space for these devices. Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
|
||||
support hot plug.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>PciBus</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>ReportStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DevicePathLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PcdLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PciIncompatibleDeviceSupportLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>pcibus.h</Filename>
|
||||
<Filename>PciIo.h</Filename>
|
||||
<Filename>PciCommand.h</Filename>
|
||||
<Filename>PciDeviceSupport.h</Filename>
|
||||
<Filename>PciResourceSupport.h</Filename>
|
||||
<Filename>PciEnumerator.h</Filename>
|
||||
<Filename>PciEnumeratorSupport.h</Filename>
|
||||
<Filename>PciOptionRomSupport.h</Filename>
|
||||
<Filename>PciRomTable.h</Filename>
|
||||
<Filename>PciHotPlugSupport.h</Filename>
|
||||
<Filename>PciLib.h</Filename>
|
||||
<Filename>PciHotPlugSupport.c</Filename>
|
||||
<Filename>PciRomTable.c</Filename>
|
||||
<Filename>PciDriverOverride.h</Filename>
|
||||
<Filename>PciPowerManagement.h</Filename>
|
||||
<Filename>PciPowerManagement.c</Filename>
|
||||
<Filename>PciDriverOverride.c</Filename>
|
||||
<Filename>PciOptionRomSupport.c</Filename>
|
||||
<Filename>PciEnumerator.c</Filename>
|
||||
<Filename>PciEnumeratorSupport.c</Filename>
|
||||
<Filename>PciResourceSupport.c</Filename>
|
||||
<Filename>PciCommand.c</Filename>
|
||||
<Filename>ComponentName.h</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>PciDeviceSupport.c</Filename>
|
||||
<Filename>pcibus.c</Filename>
|
||||
<Filename>PciIo.c</Filename>
|
||||
<Filename>PciLib.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="1E73767F-8F52-4603-AEB4-F29B510B6766"/>
|
||||
<Package PackageGuid="2759ded5-bb57-4b06-af4f-c398fa552719"/>
|
||||
<Package PackageGuid="BA0D78D6-2CAF-414b-BD4D-B6762A894288"/>
|
||||
<Package PackageGuid="88894582-7553-4822-B484-624E24B6DECF"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiPciRootBridgeIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiPciPlatformProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiPciHostBridgeResourceAllocationProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiPciHotPlugInitProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiBusSpecificDriverOverrideProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_PRODUCED">
|
||||
<ProtocolCName>gEfiPciHotPlugRequestProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<SystemTables>
|
||||
<SystemTableCNames Usage="ALWAYS_CONSUMED">
|
||||
<SystemTableCName>gEfiUgaIoProtocolGuid</SystemTableCName>
|
||||
</SystemTableCNames>
|
||||
<SystemTableCNames Usage="SOMETIMES_CONSUMED">
|
||||
<SystemTableCName>gEfiPciOptionRomTableGuid</SystemTableCName>
|
||||
</SystemTableCNames>
|
||||
</SystemTables>
|
||||
<Guids>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiPciOptionRomTableGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="PRIVATE">
|
||||
<GuidCName>gEfiPciHotplugDeviceGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>PciBusEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
<Extern>
|
||||
<DriverBinding>gPciBusDriverBinding</DriverBinding>
|
||||
<ComponentName>gPciBusComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
<PcdCoded>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdPciIsaEnable</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiIntelFrameworkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>This is a switch to enable ISA</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FIXED_AT_BUILD">
|
||||
<C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiIntelFrameworkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>The PCD masks for PCI incompatible devices support.</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiIntelFrameworkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>If TRUE, the PCI bus driver will support hot plug device. If not hot plug device is supported, this feature flag can be set to FALSE to save size.</HelpText>
|
||||
</PcdEntry>
|
||||
<PcdEntry PcdItemType="FEATURE_FLAG">
|
||||
<C_Name>PcdPciVgaEnable</C_Name>
|
||||
<TokenSpaceGuidCName>gEfiIntelFrameworkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
|
||||
<HelpText>Whether VGA decoding is enabled on this platform so we should avoid those aliased resources</HelpText>
|
||||
</PcdEntry>
|
||||
</PcdCoded>
|
||||
</ModuleSurfaceArea>
|
207
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
Normal file
207
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
Normal file
@ -0,0 +1,207 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciCommand.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
PciOperateRegister (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT8 Offset,
|
||||
IN UINT8 Operation,
|
||||
OUT UINT16 *PtrCommand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: Command - add argument and description to function comment
|
||||
// TODO: Offset - add argument and description to function comment
|
||||
// TODO: Operation - add argument and description to function comment
|
||||
// TODO: PtrCommand - add argument and description to function comment
|
||||
{
|
||||
UINT16 OldCommand;
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
OldCommand = 0;
|
||||
PciIo = &PciIoDevice->PciIo;
|
||||
|
||||
if (Operation != EFI_SET_REGISTER) {
|
||||
Status = PciIoRead (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
Offset,
|
||||
1,
|
||||
&OldCommand
|
||||
);
|
||||
|
||||
if (Operation == EFI_GET_REGISTER) {
|
||||
*PtrCommand = OldCommand;
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (Operation == EFI_ENABLE_REGISTER) {
|
||||
OldCommand = (UINT16) (OldCommand | Command);
|
||||
} else if (Operation == EFI_DISABLE_REGISTER) {
|
||||
OldCommand = (UINT16) (OldCommand & ~(Command));
|
||||
} else {
|
||||
OldCommand = Command;
|
||||
}
|
||||
|
||||
return PciIoWrite (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
Offset,
|
||||
1,
|
||||
&OldCommand
|
||||
);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
PciCapabilitySupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
{
|
||||
|
||||
if (PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LocateCapabilityRegBlock (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 CapId,
|
||||
IN OUT UINT8 *Offset,
|
||||
OUT UINT8 *NextRegBlock OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Locate cap reg.
|
||||
|
||||
Arguments:
|
||||
PciIoDevice - A pointer to the PCI_IO_DEVICE.
|
||||
CapId - The cap ID.
|
||||
Offset - A pointer to the offset.
|
||||
NextRegBlock - A pointer to the next block.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
UINT8 CapabilityPtr;
|
||||
UINT16 CapabilityEntry;
|
||||
UINT8 CapabilityID;
|
||||
|
||||
//
|
||||
// To check the cpability of this device supports
|
||||
//
|
||||
if (!PciCapabilitySupport (PciIoDevice)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (*Offset != 0) {
|
||||
CapabilityPtr = *Offset;
|
||||
} else {
|
||||
|
||||
CapabilityPtr = 0;
|
||||
if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
|
||||
|
||||
PciIoRead (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
|
||||
1,
|
||||
&CapabilityPtr
|
||||
);
|
||||
} else {
|
||||
|
||||
PciIoRead (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
EFI_PCI_CAPABILITY_PTR,
|
||||
1,
|
||||
&CapabilityPtr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
while (CapabilityPtr > 0x3F) {
|
||||
//
|
||||
// Mask it to DWORD alignment per PCI spec
|
||||
//
|
||||
CapabilityPtr &= 0xFC;
|
||||
PciIoRead (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
CapabilityPtr,
|
||||
1,
|
||||
&CapabilityEntry
|
||||
);
|
||||
|
||||
CapabilityID = (UINT8) CapabilityEntry;
|
||||
|
||||
if (CapabilityID == CapId) {
|
||||
*Offset = CapabilityPtr;
|
||||
if (NextRegBlock != NULL) {
|
||||
*NextRegBlock = (UINT8) (CapabilityEntry >> 8);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CapabilityPtr = (UINT8) (CapabilityEntry >> 8);
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
175
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
Normal file
175
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.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:
|
||||
|
||||
PciCommand.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_COMMAND_H
|
||||
#define _EFI_PCI_COMMAND_H
|
||||
|
||||
//
|
||||
// The PCI Command register bits owned by PCI Bus driver.
|
||||
//
|
||||
// They should be cleared at the beginning. The other registers
|
||||
// are owned by chipset, we should not touch them.
|
||||
//
|
||||
#define EFI_PCI_COMMAND_BITS_OWNED ( \
|
||||
EFI_PCI_COMMAND_IO_SPACE | \
|
||||
EFI_PCI_COMMAND_MEMORY_SPACE | \
|
||||
EFI_PCI_COMMAND_BUS_MASTER | \
|
||||
EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE | \
|
||||
EFI_PCI_COMMAND_VGA_PALETTE_SNOOP | \
|
||||
EFI_PCI_COMMAND_FAST_BACK_TO_BACK \
|
||||
)
|
||||
|
||||
//
|
||||
// The PCI Bridge Control register bits owned by PCI Bus driver.
|
||||
//
|
||||
// They should be cleared at the beginning. The other registers
|
||||
// are owned by chipset, we should not touch them.
|
||||
//
|
||||
#define EFI_PCI_BRIDGE_CONTROL_BITS_OWNED ( \
|
||||
EFI_PCI_BRIDGE_CONTROL_ISA | \
|
||||
EFI_PCI_BRIDGE_CONTROL_VGA | \
|
||||
EFI_PCI_BRIDGE_CONTROL_VGA_16 | \
|
||||
EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
|
||||
)
|
||||
|
||||
//
|
||||
// The PCCard Bridge Control register bits owned by PCI Bus driver.
|
||||
//
|
||||
// They should be cleared at the beginning. The other registers
|
||||
// are owned by chipset, we should not touch them.
|
||||
//
|
||||
#define EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED ( \
|
||||
EFI_PCI_BRIDGE_CONTROL_ISA | \
|
||||
EFI_PCI_BRIDGE_CONTROL_VGA | \
|
||||
EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
|
||||
)
|
||||
|
||||
|
||||
#define EFI_GET_REGISTER 1
|
||||
#define EFI_SET_REGISTER 2
|
||||
#define EFI_ENABLE_REGISTER 3
|
||||
#define EFI_DISABLE_REGISTER 4
|
||||
|
||||
EFI_STATUS
|
||||
PciOperateRegister (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT8 Offset,
|
||||
IN UINT8 Operation,
|
||||
OUT UINT16 *PtrCommand
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
PtrCommand - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciCapabilitySupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LocateCapabilityRegBlock (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 CapId,
|
||||
IN OUT UINT8 *Offset,
|
||||
OUT UINT8 *NextRegBlock OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
CapId - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
NextRegBlock - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
#define PciReadCommandRegister(a,b) \
|
||||
PciOperateRegister (a,0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
|
||||
|
||||
#define PciSetCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
|
||||
|
||||
#define PciEnableCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||
|
||||
#define PciDisableCommandRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||
|
||||
#define PciReadBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
|
||||
|
||||
#define PciSetBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
|
||||
|
||||
#define PciEnableBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
|
||||
|
||||
#define PciDisableBridgeControlRegister(a,b) \
|
||||
PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
|
||||
|
||||
#endif
|
1351
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
Normal file
1351
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
477
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
Normal file
477
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
Normal file
@ -0,0 +1,477 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciDeviceSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_DEVICE_SUPPORT_H
|
||||
#define _EFI_PCI_DEVICE_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDevicePool (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertRootBridge (
|
||||
PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertPciDevice (
|
||||
PCI_IO_DEVICE *Bridge,
|
||||
PCI_IO_DEVICE *PciDeviceNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
PciDeviceNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyPciDeviceTree (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyRootBridgeByHandle (
|
||||
EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RegisterPciDevice (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
OUT EFI_HANDLE *Handle OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
Handle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RemoveAllPciDeviceOnBridge (
|
||||
EFI_HANDLE RootBridgeHandle,
|
||||
PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DeRegisterPciDevice (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
Handle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartPciDevicesOnBridge (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN PCI_IO_DEVICE *RootBridge,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
IN OUT UINT8 *NumberOfChildren,
|
||||
IN OUT EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
RootBridge - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartPciDevices (
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
CreateRootBridge (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GetRootBridgeByHandle (
|
||||
EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
RootBridgeExisted (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciDeviceExisted (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
ActiveVGADeviceOnTheSameSegment (
|
||||
IN PCI_IO_DEVICE *VgaDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
VgaDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
ActiveVGADeviceOnTheRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetHpcPciAddress (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINT64 *PciAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
HpcDevicePath - TODO: add argument description
|
||||
PciAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetHpcPciAddressFromRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridge,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
|
||||
OUT UINT64 *PciAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridge - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
PciAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
FreePciDevice (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
175
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
Normal file
175
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
Normal file
@ -0,0 +1,175 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciDriverOverride.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDriverOverrideInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initializes a PCI Driver Override Instance
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetDriver (
|
||||
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||
IN OUT EFI_HANDLE *DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get a overriding driver image
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: DriverImageHandle - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_INVALID_PARAMETER - add return value to function comment
|
||||
{
|
||||
PCI_IO_DEVICE *PciIoDevice;
|
||||
LIST_ENTRY *CurrentLink;
|
||||
PCI_DRIVER_OVERRIDE_LIST *Node;
|
||||
|
||||
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS (This);
|
||||
|
||||
CurrentLink = PciIoDevice->OptionRomDriverList.ForwardLink;
|
||||
|
||||
while (CurrentLink && CurrentLink != &PciIoDevice->OptionRomDriverList) {
|
||||
|
||||
Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink);
|
||||
|
||||
if (*DriverImageHandle == NULL) {
|
||||
|
||||
*DriverImageHandle = Node->DriverImageHandle;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (*DriverImageHandle == Node->DriverImageHandle) {
|
||||
|
||||
if (CurrentLink->ForwardLink == &PciIoDevice->OptionRomDriverList ||
|
||||
CurrentLink->ForwardLink == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Get next node
|
||||
//
|
||||
Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink->ForwardLink);
|
||||
*DriverImageHandle = Node->DriverImageHandle;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CurrentLink = CurrentLink->ForwardLink;
|
||||
}
|
||||
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
AddDriver (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_HANDLE DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Add a overriding driver image
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: DriverImageHandle - add argument and description to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_NT_HEADERS *PeHdr;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
PCI_DRIVER_OVERRIDE_LIST *Node;
|
||||
|
||||
Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Node = AllocatePool (sizeof (PCI_DRIVER_OVERRIDE_LIST));
|
||||
if (Node == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Node->Signature = DRIVER_OVERRIDE_SIGNATURE;
|
||||
Node->DriverImageHandle = DriverImageHandle;
|
||||
|
||||
InsertTailList (&PciIoDevice->OptionRomDriverList, &(Node->Link));
|
||||
|
||||
PciIoDevice->BusOverride = TRUE;
|
||||
|
||||
DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
|
||||
if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
|
||||
|
||||
if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
108
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
Normal file
108
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
Normal file
@ -0,0 +1,108 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciDriverOverride.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_DRIVER_OVERRRIDE_H
|
||||
#define _EFI_PCI_DRIVER_OVERRRIDE_H
|
||||
|
||||
#define DRIVER_OVERRIDE_SIGNATURE EFI_SIGNATURE_32 ('d', 'r', 'o', 'v')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HANDLE DriverImageHandle;
|
||||
} PCI_DRIVER_OVERRIDE_LIST;
|
||||
|
||||
|
||||
#define DRIVER_OVERRIDE_FROM_LINK(a) \
|
||||
CR (a, PCI_DRIVER_OVERRIDE_LIST, Link, DRIVER_OVERRIDE_SIGNATURE)
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDriverOverrideInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AddDriver (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_HANDLE DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
DriverImageHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetDriver (
|
||||
IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||
IN OUT EFI_HANDLE *DriverImageHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
DriverImageHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2168
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
Normal file
2168
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
Normal file
File diff suppressed because it is too large
Load Diff
628
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
Normal file
628
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
Normal file
@ -0,0 +1,628 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciEnumerator.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ENUMERATOR_H
|
||||
#define _EFI_PCI_ENUMERATOR_H
|
||||
|
||||
#include "PciResourceSupport.h"
|
||||
|
||||
EFI_STATUS
|
||||
PciEnumerator (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRootBridgeEnumerator (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOptionRom (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT64 RomBase,
|
||||
IN UINT64 MaxLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
RomBase - TODO: add argument description
|
||||
MaxLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciAssignBusNumber (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
SubBusNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DetermineRootBridgeAttributes (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
UINT64
|
||||
GetMaxOptionRomSize (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeDeviceAttribute (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceAllocationStatus (
|
||||
VOID *AcpiConfig,
|
||||
OUT UINT64 *IoResStatus,
|
||||
OUT UINT64 *Mem32ResStatus,
|
||||
OUT UINT64 *PMem32ResStatus,
|
||||
OUT UINT64 *Mem64ResStatus,
|
||||
OUT UINT64 *PMem64ResStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
AcpiConfig - TODO: add argument description
|
||||
IoResStatus - TODO: add argument description
|
||||
Mem32ResStatus - TODO: add argument description
|
||||
PMem32ResStatus - TODO: add argument description
|
||||
Mem64ResStatus - TODO: add argument description
|
||||
PMem64ResStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RejectPciDevice (
|
||||
IN PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRejectiveDevice (
|
||||
IN PCI_RESOURCE_NODE *PciResNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
GetLargerConsumerDevice (
|
||||
IN PCI_RESOURCE_NODE *PciResNode1,
|
||||
IN PCI_RESOURCE_NODE *PciResNode2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResNode1 - TODO: add argument description
|
||||
PciResNode2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
GetMaxResourceConsumerDevice (
|
||||
IN PCI_RESOURCE_NODE *ResPool
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ResPool - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeAdjustAllocation (
|
||||
IN PCI_RESOURCE_NODE *IoPool,
|
||||
IN PCI_RESOURCE_NODE *Mem32Pool,
|
||||
IN PCI_RESOURCE_NODE *PMem32Pool,
|
||||
IN PCI_RESOURCE_NODE *Mem64Pool,
|
||||
IN PCI_RESOURCE_NODE *PMem64Pool,
|
||||
IN UINT64 IoResStatus,
|
||||
IN UINT64 Mem32ResStatus,
|
||||
IN UINT64 PMem32ResStatus,
|
||||
IN UINT64 Mem64ResStatus,
|
||||
IN UINT64 PMem64ResStatus
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
IoPool - TODO: add argument description
|
||||
Mem32Pool - TODO: add argument description
|
||||
PMem32Pool - TODO: add argument description
|
||||
Mem64Pool - TODO: add argument description
|
||||
PMem64Pool - TODO: add argument description
|
||||
IoResStatus - TODO: add argument description
|
||||
Mem32ResStatus - TODO: add argument description
|
||||
PMem32ResStatus - TODO: add argument description
|
||||
Mem64ResStatus - TODO: add argument description
|
||||
PMem64ResStatus - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ConstructAcpiResourceRequestor (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *IoNode,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node,
|
||||
OUT VOID **pConfig
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
pConfig - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceBase (
|
||||
IN VOID *pConfig,
|
||||
OUT UINT64 *IoBase,
|
||||
OUT UINT64 *Mem32Base,
|
||||
OUT UINT64 *PMem32Base,
|
||||
OUT UINT64 *Mem64Base,
|
||||
OUT UINT64 *PMem64Base
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
pConfig - TODO: add argument description
|
||||
IoBase - TODO: add argument description
|
||||
Mem32Base - TODO: add argument description
|
||||
PMem32Base - TODO: add argument description
|
||||
Mem64Base - TODO: add argument description
|
||||
PMem64Base - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciBridgeEnumerator (
|
||||
IN PCI_IO_DEVICE *BridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
BridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciBridgeResourceAllocator (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceBaseFromBridge (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
OUT UINT64 *IoBase,
|
||||
OUT UINT64 *Mem32Base,
|
||||
OUT UINT64 *PMem32Base,
|
||||
OUT UINT64 *Mem64Base,
|
||||
OUT UINT64 *PMem64Base
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoBase - TODO: add argument description
|
||||
Mem32Base - TODO: add argument description
|
||||
PMem32Base - TODO: add argument description
|
||||
Mem64Base - TODO: add argument description
|
||||
PMem64Base - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeP2CProcess (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
NotifyPhase (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
|
||||
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
Phase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PreprocessController (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Device,
|
||||
IN UINT8 Func,
|
||||
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
Phase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciHotPlugRequestNotify (
|
||||
IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL * This,
|
||||
IN EFI_PCI_HOTPLUG_OPERATION Operation,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL,
|
||||
IN OUT UINT8 *NumberOfChildren,
|
||||
IN OUT EFI_HANDLE * ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Controller - TODO: add argument description
|
||||
RemainingDevicePath - TODO: add argument description
|
||||
NumberOfChildren - TODO: add argument description
|
||||
ChildHandleBuffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
SearchHostBridgeHandle (
|
||||
IN EFI_HANDLE RootBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AddHostBridgeEnumerator (
|
||||
IN EFI_HANDLE HostBridgeHandle
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HostBridgeHandle - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2254
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
Normal file
2254
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,598 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciEnumeratorSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H
|
||||
#define _EFI_PCI_ENUMERATOR_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
PciDevicePresent (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciPciDeviceInfoCollector (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
UINT8 StartBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciSearchDevice (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func,
|
||||
PCI_IO_DEVICE **PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherDeviceInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherPpbInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
GatherP2CInfo (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
CreatePciDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ParentDevicePath - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
BarExisted (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINTN Offset,
|
||||
OUT UINT32 *BarLengthValue,
|
||||
OUT UINT32 *OriginalBarValue
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
BarLengthValue - TODO: add argument description
|
||||
OriginalBarValue - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciTestSupportedAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 *Command,
|
||||
IN UINT16 *BridgeControl,
|
||||
IN UINT16 *OldCommand,
|
||||
IN UINT16 *OldBridgeControl
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
BridgeControl - TODO: add argument description
|
||||
OldCommand - TODO: add argument description
|
||||
OldBridgeControl - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciSetDeviceAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT16 Command,
|
||||
IN UINT16 BridgeControl,
|
||||
IN UINTN Option
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Command - TODO: add argument description
|
||||
BridgeControl - TODO: add argument description
|
||||
Option - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetFastBackToBackSupport (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT8 StatusIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
StatusIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DetermineDeviceAttribute (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UpdatePciInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
SetNewAlign (
|
||||
IN UINT64 *Alignment,
|
||||
IN UINT64 NewAlignment
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Alignment - TODO: add argument description
|
||||
NewAlignment - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
UINTN
|
||||
PciParseBar (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BarIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciDevice (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializePpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeP2C (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_IO_DEVICE *
|
||||
CreatePciIoDevice (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
UINT8 Bus,
|
||||
UINT8 Device,
|
||||
UINT8 Func
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
Pci - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciEnumeratorLight (
|
||||
IN EFI_HANDLE Controller
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Controller - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciGetBusRange (
|
||||
IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
|
||||
OUT UINT16 *MinBus,
|
||||
OUT UINT16 *MaxBus,
|
||||
OUT UINT16 *BusRange
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Descriptors - TODO: add argument description
|
||||
MinBus - TODO: add argument description
|
||||
MaxBus - TODO: add argument description
|
||||
BusRange - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
StartManagingRootBridge (
|
||||
IN PCI_IO_DEVICE *RootBridgeDev
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeDev - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsPciDeviceRejected (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
463
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
Normal file
463
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
Normal file
@ -0,0 +1,463 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciHotPlugSupport.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "Pcibus.h"
|
||||
#include "PciHotPlugSupport.h"
|
||||
|
||||
EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
||||
EFI_HPC_LOCATION *gPciRootHpcPool;
|
||||
UINTN gPciRootHpcCount;
|
||||
ROOT_HPC_DATA *gPciRootHpcData;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PciHPCInitialized (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: Event - add argument and description to function comment
|
||||
// TODO: Context - add argument and description to function comment
|
||||
{
|
||||
ROOT_HPC_DATA *HpcData;
|
||||
|
||||
HpcData = (ROOT_HPC_DATA *) Context;
|
||||
HpcData->Initialized = TRUE;
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EfiCompareDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: DevicePath1 - add argument and description to function comment
|
||||
// TODO: DevicePath2 - add argument and description to function comment
|
||||
{
|
||||
UINTN Size1;
|
||||
UINTN Size2;
|
||||
|
||||
Size1 = GetDevicePathSize (DevicePath1);
|
||||
Size2 = GetDevicePathSize (DevicePath2);
|
||||
|
||||
if (Size1 != Size2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CompareMem (DevicePath1, DevicePath2, Size1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotPlugSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HPC_LOCATION *HpcList;
|
||||
UINTN HpcCount;
|
||||
|
||||
//
|
||||
// Locate the PciHotPlugInit Protocol
|
||||
// If it doesn't exist, that means there is no
|
||||
// hot plug controller supported on the platform
|
||||
// the PCI Bus driver is running on. HotPlug Support
|
||||
// is an optional feature, so absence of the protocol
|
||||
// won't incur the penalty
|
||||
//
|
||||
gPciHotPlugInit = NULL;
|
||||
gPciRootHpcPool = NULL;
|
||||
gPciRootHpcCount = 0;
|
||||
gPciRootHpcData = NULL;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiPciHotPlugInitProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &gPciHotPlugInit
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Status = gPciHotPlugInit->GetRootHpcList (
|
||||
gPciHotPlugInit,
|
||||
&HpcCount,
|
||||
&HpcList
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
gPciRootHpcPool = HpcList;
|
||||
gPciRootHpcCount = HpcCount;
|
||||
gPciRootHpcData = AllocateZeroPool (sizeof (ROOT_HPC_DATA) * gPciRootHpcCount);
|
||||
if (gPciRootHpcData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugBus (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
||||
HpIndex - A pointer to the Index.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: HpbDevicePath - add argument and description to function comment
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpbDevicePath, HpbDevicePath)) {
|
||||
|
||||
if (HpIndex != NULL) {
|
||||
*HpIndex = Index;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugController (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
|
||||
HpIndex - A pointer to the Index.
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpcDevicePath, HpcDevicePath)) {
|
||||
|
||||
if (HpIndex != NULL) {
|
||||
*HpIndex = Index;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
CreateEventForHpc (
|
||||
IN UINTN HpIndex,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: HpIndex - add argument and description to function comment
|
||||
// TODO: Event - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->CreateEvent (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
PciHPCInitialized,
|
||||
gPciRootHpcData + HpIndex,
|
||||
&((gPciRootHpcData + HpIndex)->Event)
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*Event = (gPciRootHpcData + HpIndex)->Event;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
AllRootHPCInitialized (
|
||||
IN UINTN TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
TimeoutInMicroSeconds - microseconds to wait for all root hpc's initialization
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - All root hpc's initialization is finished before the timeout
|
||||
EFI_TIMEOUT - Time out
|
||||
|
||||
--*/
|
||||
// TODO: TimeoutInMilliSeconds - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_TIMEOUT - add return value to function comment
|
||||
{
|
||||
UINT32 Delay;
|
||||
UINTN Index;
|
||||
|
||||
Delay = (UINT32) ((TimeoutInMicroSeconds / 30) + 1);
|
||||
do {
|
||||
|
||||
for (Index = 0; Index < gPciRootHpcCount; Index++) {
|
||||
|
||||
if (!gPciRootHpcData[Index].Initialized) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Index == gPciRootHpcCount) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Stall for 30 us
|
||||
//
|
||||
gBS->Stall (30);
|
||||
|
||||
Delay--;
|
||||
|
||||
} while (Delay);
|
||||
|
||||
return EFI_TIMEOUT;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IsSHPC (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
|
||||
EFI_STATUS Status;
|
||||
UINT8 Offset;
|
||||
|
||||
if (!PciIoDevice) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Offset = 0;
|
||||
Status = LocateCapabilityRegBlock (
|
||||
PciIoDevice,
|
||||
EFI_PCI_CAPABILITY_ID_HOTPLUG,
|
||||
&Offset,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// If the PPB has the hot plug controller build-in,
|
||||
// then return TRUE;
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
GetResourcePaddingForHpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HPC_STATE State;
|
||||
UINT64 PciAddress;
|
||||
EFI_HPC_PADDING_ATTRIBUTES Attributes;
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
|
||||
|
||||
Status = IsPciHotPlugBus (PciIoDevice);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
|
||||
Status = gPciHotPlugInit->GetResourcePadding (
|
||||
gPciHotPlugInit,
|
||||
PciIoDevice->DevicePath,
|
||||
PciAddress,
|
||||
&State,
|
||||
(VOID **) &Descriptors,
|
||||
&Attributes
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if ((State & EFI_HPC_STATE_ENABLED) && (State & EFI_HPC_STATE_INITIALIZED)) {
|
||||
PciIoDevice->ResourcePaddingDescriptors = Descriptors;
|
||||
PciIoDevice->PaddingAttributes = Attributes;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
IsPciHotPlugBus (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
{
|
||||
BOOLEAN Result;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = IsSHPC (PciIoDevice);
|
||||
|
||||
//
|
||||
// If the PPB has the hot plug controller build-in,
|
||||
// then return TRUE;
|
||||
//
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Otherwise, see if it is a Root HPC
|
||||
//
|
||||
Result = IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL);
|
||||
|
||||
if (Result) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
264
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
Normal file
264
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
Normal file
@ -0,0 +1,264 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciHotPlugSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H
|
||||
#define _EFI_PCI_HOT_PLUG_SUPPORT_H
|
||||
|
||||
|
||||
//
|
||||
// stall 1 second
|
||||
//
|
||||
#define STALL_1_SECOND 1000000
|
||||
|
||||
typedef struct {
|
||||
EFI_EVENT Event;
|
||||
BOOLEAN Initialized;
|
||||
VOID *Padding;
|
||||
} ROOT_HPC_DATA;
|
||||
|
||||
extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
|
||||
extern EFI_HPC_LOCATION *gPciRootHpcPool;
|
||||
extern UINTN gPciRootHpcCount;
|
||||
extern ROOT_HPC_DATA *gPciRootHpcData;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
PciHPCInitialized (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Event - TODO: add argument description
|
||||
Context - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
EfiCompareDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
DevicePath1 - TODO: add argument description
|
||||
DevicePath2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeHotPlugSupport (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
None
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
IsPciHotPlugBus (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugBus (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpbDevicePath - TODO: add argument description
|
||||
HpIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
IsRootPciHotPlugController (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
|
||||
OUT UINTN *HpIndex
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpcDevicePath - TODO: add argument description
|
||||
HpIndex - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateEventForHpc (
|
||||
IN UINTN HpIndex,
|
||||
OUT EFI_EVENT *Event
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
HpIndex - TODO: add argument description
|
||||
Event - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
AllRootHPCInitialized (
|
||||
IN UINTN TimeoutInMicroSeconds
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
TimeoutInMicroSeconds - microseconds to wait for all root hpc's initialization
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - All root hpc's initialization is finished before the timeout
|
||||
EFI_TIMEOUT - Time out
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
IsSHPC (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourcePaddingForHpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
1980
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
Normal file
1980
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
Normal file
File diff suppressed because it is too large
Load Diff
773
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
Normal file
773
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
Normal file
@ -0,0 +1,773 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciIo.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_IO_PROTOCOL_H
|
||||
#define _EFI_PCI_IO_PROTOCOL_H
|
||||
|
||||
EFI_STATUS
|
||||
InitializePciIoInstance (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciIoVerifyBarAccess (
|
||||
PCI_IO_DEVICE *PciIoDevice,
|
||||
UINT8 BarIndex,
|
||||
PCI_BAR_TYPE Type,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINTN Count,
|
||||
UINT64 *Offset
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Type - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciIoVerifyConfigAccess (
|
||||
PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINTN Count,
|
||||
IN UINT64 *Offset
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoPollMem (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINT64 Mask,
|
||||
IN UINT64 Value,
|
||||
IN UINT64 Delay,
|
||||
OUT UINT64 *Result
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Mask - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Delay - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoPollIo (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINT64 Mask,
|
||||
IN UINT64 Value,
|
||||
IN UINT64 Delay,
|
||||
OUT UINT64 *Result
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Mask - TODO: add argument description
|
||||
Value - TODO: add argument description
|
||||
Delay - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMemRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMemWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoIoRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoIoWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT64 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoConfigRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoConfigWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Offset,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
Buffer - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoCopyMem (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT8 DestBarIndex,
|
||||
IN UINT64 DestOffset,
|
||||
IN UINT8 SrcBarIndex,
|
||||
IN UINT64 SrcOffset,
|
||||
IN UINTN Count
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Width - TODO: add argument description
|
||||
DestBarIndex - TODO: add argument description
|
||||
DestOffset - TODO: add argument description
|
||||
SrcBarIndex - TODO: add argument description
|
||||
SrcOffset - TODO: add argument description
|
||||
Count - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoMap (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
|
||||
IN VOID *HostAddress,
|
||||
IN OUT UINTN *NumberOfBytes,
|
||||
OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
|
||||
OUT VOID **Mapping
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
NumberOfBytes - TODO: add argument description
|
||||
DeviceAddress - TODO: add argument description
|
||||
Mapping - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoUnmap (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN VOID *Mapping
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Mapping - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoAllocateBuffer (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN Pages,
|
||||
OUT VOID **HostAddress,
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Type - TODO: add argument description
|
||||
MemoryType - TODO: add argument description
|
||||
Pages - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoFreeBuffer (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN UINTN Pages,
|
||||
IN VOID *HostAddress
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Pages - TODO: add argument description
|
||||
HostAddress - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoFlush (
|
||||
IN EFI_PCI_IO_PROTOCOL *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoGetLocation (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
OUT UINTN *Segment,
|
||||
OUT UINTN *Bus,
|
||||
OUT UINTN *Device,
|
||||
OUT UINTN *Function
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Segment - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Device - TODO: add argument description
|
||||
Function - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
CheckBarType (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
UINT8 BarIndex,
|
||||
PCI_BAR_TYPE BarType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
BarType - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ModifyRootBridgeAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN UINT64 Attributes,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SupportPaletteSnoopAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL * This,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||
IN UINT64 Attributes,
|
||||
OUT UINT64 *Result OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
Result - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoGetBarAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL * This,
|
||||
IN UINT8 BarIndex,
|
||||
OUT UINT64 *Supports, OPTIONAL
|
||||
OUT VOID **Resources OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Supports - TODO: add argument description
|
||||
Resources - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciIoSetBarAttributes (
|
||||
IN EFI_PCI_IO_PROTOCOL *This,
|
||||
IN UINT64 Attributes,
|
||||
IN UINT8 BarIndex,
|
||||
IN OUT UINT64 *Offset,
|
||||
IN OUT UINT64 *Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
BarIndex - TODO: add argument description
|
||||
Offset - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
UpStreamBridgesAttributes (
|
||||
IN PCI_IO_DEVICE *PciIoDevice,
|
||||
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
Operation - TODO: add argument description
|
||||
Attributes - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PciDevicesOnTheSamePath (
|
||||
IN PCI_IO_DEVICE *PciDevice1,
|
||||
IN PCI_IO_DEVICE *PciDevice2
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice1 - TODO: add argument description
|
||||
PciDevice2 - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2885
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
Normal file
2885
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
Normal file
File diff suppressed because it is too large
Load Diff
385
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
Normal file
385
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
Normal file
@ -0,0 +1,385 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciLib.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver Lib header file.
|
||||
Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
|
||||
support hot plug.
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_LIB_H
|
||||
#define _EFI_PCI_LIB_H
|
||||
|
||||
//
|
||||
// Mask definistions for PCD PcdPciIncompatibleDeviceSupportMask
|
||||
//
|
||||
#define PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT 0x01
|
||||
#define PCI_INCOMPATIBLE_READ_SUPPORT 0x02
|
||||
#define PCI_INCOMPATIBLE_WRITE_SUPPORT 0x04
|
||||
#define PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT 0x08
|
||||
#define PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT 0x0a
|
||||
|
||||
VOID
|
||||
InstallHotPlugRequestProtocol (
|
||||
IN EFI_STATUS *Status
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Status - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
InstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
UninstallPciHotplugGuid (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
GetBackPcCardBar (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RemoveRejectedPciDevices (
|
||||
EFI_HANDLE RootBridgeHandle,
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
RootBridgeHandle - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeResourceAllocator (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciScanBus (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber,
|
||||
OUT UINT8 *PaddedBusRange
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
StartBusNumber - TODO: add argument description
|
||||
SubBusNumber - TODO: add argument description
|
||||
PaddedBusRange - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciScanBus_WithHotPlugDeviceSupport (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber,
|
||||
OUT UINT8 *PaddedBusRange
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciScanBus_WithoutHotPlugDeviceSupport (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber,
|
||||
OUT UINT8 *SubBusNumber,
|
||||
OUT UINT8 *PaddedBusRange
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRootBridgeP2CProcess (
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeP2CProcess (
|
||||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciHostBridgeEnumerator (
|
||||
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciResAlloc - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
/**
|
||||
Read PCI configuration space through EFI_PCI_IO_PROTOCOL.
|
||||
|
||||
@param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
|
||||
@param Width Signifies the width of the memory operations.
|
||||
@Param Address The address within the PCI configuration space for the PCI controller.
|
||||
@param Buffer For read operations, the destination buffer to store the results. For
|
||||
write operations, the source buffer to write data from.
|
||||
|
||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PciIoRead (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
|
||||
|
||||
@param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
|
||||
@param Width Signifies the width of the memory operations.
|
||||
@Param Address The address within the PCI configuration space for the PCI controller.
|
||||
@param Buffer For read operations, the destination buffer to store the results. For
|
||||
write operations, the source buffer to write data from.
|
||||
|
||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PciIoWrite (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT32 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||
|
||||
@param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||
@param Pci A pointer to PCI_TYPE00.
|
||||
@param Width Signifies the width of the memory operations.
|
||||
@Param Address The address within the PCI configuration space for the PCI controller.
|
||||
@param Buffer For read operations, the destination buffer to store the results. For
|
||||
write operations, the source buffer to write data from.
|
||||
|
||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PciRootBridgeIoWrite (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||
|
||||
@param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
|
||||
@param Pci A pointer to PCI_TYPE00.
|
||||
@param Width Signifies the width of the memory operations.
|
||||
@Param Address The address within the PCI configuration space for the PCI controller.
|
||||
@param Buffer For read operations, the destination buffer to store the results. For
|
||||
write operations, the source buffer to write data from.
|
||||
|
||||
@retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
|
||||
@retval EFI_INVALID_PARAMETER Buffer is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
PciRootBridgeIoRead (
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
IN PCI_TYPE00 *Pci,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
|
||||
IN UINT64 Address,
|
||||
IN UINTN Count,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
#endif
|
564
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
Normal file
564
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
Normal file
@ -0,0 +1,564 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciOptionRomSupport.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
#include "PciResourceSupport.h"
|
||||
|
||||
//
|
||||
// Min Max
|
||||
//
|
||||
#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define EFI_MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetOpRomInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
UINT8 RomBarIndex;
|
||||
UINT32 AllOnes;
|
||||
UINT64 Address;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Bus;
|
||||
UINT8 Device;
|
||||
UINT8 Function;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
|
||||
Bus = PciIoDevice->BusNumber;
|
||||
Device = PciIoDevice->DeviceNumber;
|
||||
Function = PciIoDevice->FunctionNumber;
|
||||
|
||||
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
||||
|
||||
//
|
||||
// offset is 0x30 if is not ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x30
|
||||
//
|
||||
RomBarIndex = PCI_DEVICE_ROMBAR;
|
||||
|
||||
if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
|
||||
//
|
||||
// if is ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x38
|
||||
//
|
||||
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
||||
}
|
||||
//
|
||||
// the bit0 is 0 to prevent the enabling of the Rom address decoder
|
||||
//
|
||||
AllOnes = 0xfffffffe;
|
||||
Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
|
||||
|
||||
Status = PciRootBridgeIoWrite (
|
||||
PciRootBridgeIo,
|
||||
&PciIoDevice->Pci,
|
||||
EfiPciWidthUint32,
|
||||
Address,
|
||||
1,
|
||||
&AllOnes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// read back
|
||||
//
|
||||
Status = PciRootBridgeIoRead (
|
||||
PciRootBridgeIo,
|
||||
&PciIoDevice->Pci,
|
||||
EfiPciWidthUint32,
|
||||
Address,
|
||||
1,
|
||||
&AllOnes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Bits [1, 10] are reserved
|
||||
//
|
||||
AllOnes &= 0xFFFFF800;
|
||||
if ((AllOnes == 0) || (AllOnes == 0xFFFFF800)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
PciIoDevice->RomSize = (UINT64) ((~AllOnes) + 1);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LoadOpRomImage (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT64 RomBase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Load option rom image for specified PCI device
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciDevice - add argument and description to function comment
|
||||
// TODO: RomBase - add argument and description to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
|
||||
{
|
||||
UINT8 RomBarIndex;
|
||||
UINT8 Indicator;
|
||||
UINT16 OffsetPcir;
|
||||
UINT32 RomBarOffset;
|
||||
UINT32 RomBar;
|
||||
EFI_STATUS retStatus;
|
||||
BOOLEAN FirstCheck;
|
||||
UINT8 *Image;
|
||||
PCI_EXPANSION_ROM_HEADER *RomHeader;
|
||||
PCI_DATA_STRUCTURE *RomPcir;
|
||||
UINT64 RomSize;
|
||||
UINT64 RomImageSize;
|
||||
UINT8 *RomInMemory;
|
||||
UINT8 CodeType;
|
||||
|
||||
RomSize = PciDevice->RomSize;
|
||||
|
||||
Indicator = 0;
|
||||
RomImageSize = 0;
|
||||
RomInMemory = NULL;
|
||||
CodeType = 0xFF;
|
||||
|
||||
//
|
||||
// Get the RomBarIndex
|
||||
//
|
||||
|
||||
//
|
||||
// 0x30
|
||||
//
|
||||
RomBarIndex = PCI_DEVICE_ROMBAR;
|
||||
if (IS_PCI_BRIDGE (&(PciDevice->Pci))) {
|
||||
//
|
||||
// if is ppb
|
||||
//
|
||||
|
||||
//
|
||||
// 0x38
|
||||
//
|
||||
RomBarIndex = PCI_BRIDGE_ROMBAR;
|
||||
}
|
||||
//
|
||||
// Allocate memory for Rom header and PCIR
|
||||
//
|
||||
RomHeader = AllocatePool (sizeof (PCI_EXPANSION_ROM_HEADER));
|
||||
if (RomHeader == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RomPcir = AllocatePool (sizeof (PCI_DATA_STRUCTURE));
|
||||
if (RomPcir == NULL) {
|
||||
gBS->FreePool (RomHeader);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
RomBar = (UINT32) RomBase;
|
||||
|
||||
//
|
||||
// Enable RomBar
|
||||
//
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, TRUE);
|
||||
|
||||
RomBarOffset = RomBar;
|
||||
retStatus = EFI_NOT_FOUND;
|
||||
FirstCheck = TRUE;
|
||||
|
||||
do {
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBarOffset,
|
||||
sizeof (PCI_EXPANSION_ROM_HEADER),
|
||||
(UINT8 *) RomHeader
|
||||
);
|
||||
|
||||
if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||
RomBarOffset = RomBarOffset + 512;
|
||||
if (FirstCheck) {
|
||||
break;
|
||||
} else {
|
||||
RomImageSize = RomImageSize + 512;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
FirstCheck = FALSE;
|
||||
OffsetPcir = RomHeader->PcirOffset;
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBarOffset + OffsetPcir,
|
||||
sizeof (PCI_DATA_STRUCTURE),
|
||||
(UINT8 *) RomPcir
|
||||
);
|
||||
if (RomPcir->CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
|
||||
CodeType = PCI_CODE_TYPE_PCAT_IMAGE;
|
||||
}
|
||||
Indicator = RomPcir->Indicator;
|
||||
RomImageSize = RomImageSize + RomPcir->ImageLength * 512;
|
||||
RomBarOffset = RomBarOffset + RomPcir->ImageLength * 512;
|
||||
} while (((Indicator & 0x80) == 0x00) && ((RomBarOffset - RomBar) < RomSize));
|
||||
|
||||
//
|
||||
// Some Legacy Cards do not report the correct ImageLength so used the maximum
|
||||
// of the legacy length and the PCIR Image Length
|
||||
//
|
||||
if (CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
|
||||
RomImageSize = EFI_MAX(RomImageSize, (((EFI_LEGACY_EXPANSION_ROM_HEADER *)RomHeader)->Size512 * 512));
|
||||
}
|
||||
|
||||
if (RomImageSize > 0) {
|
||||
retStatus = EFI_SUCCESS;
|
||||
Image = AllocatePool ((UINT32) RomImageSize);
|
||||
if (Image == NULL) {
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
|
||||
gBS->FreePool (RomHeader);
|
||||
gBS->FreePool (RomPcir);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy Rom image into memory
|
||||
//
|
||||
PciDevice->PciRootBridgeIo->Mem.Read (
|
||||
PciDevice->PciRootBridgeIo,
|
||||
EfiPciWidthUint8,
|
||||
RomBar,
|
||||
(UINT32) RomImageSize,
|
||||
Image
|
||||
);
|
||||
RomInMemory = Image;
|
||||
}
|
||||
|
||||
RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
|
||||
|
||||
PciDevice->PciIo.RomSize = RomImageSize;
|
||||
PciDevice->PciIo.RomImage = RomInMemory;
|
||||
|
||||
PciRomAddImageMapping (
|
||||
NULL,
|
||||
PciDevice->PciRootBridgeIo->SegmentNumber,
|
||||
PciDevice->BusNumber,
|
||||
PciDevice->DeviceNumber,
|
||||
PciDevice->FunctionNumber,
|
||||
(UINT64) (UINTN) PciDevice->PciIo.RomImage,
|
||||
PciDevice->PciIo.RomSize
|
||||
);
|
||||
|
||||
//
|
||||
// Free allocated memory
|
||||
//
|
||||
gBS->FreePool (RomHeader);
|
||||
gBS->FreePool (RomPcir);
|
||||
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
RomDecode (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT8 RomBarIndex,
|
||||
IN UINT32 RomBar,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciDevice - add argument and description to function comment
|
||||
// TODO: RomBarIndex - add argument and description to function comment
|
||||
// TODO: RomBar - add argument and description to function comment
|
||||
// TODO: Enable - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
UINT32 Value32;
|
||||
UINT32 Offset;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
PciIo = &PciDevice->PciIo;
|
||||
if (Enable) {
|
||||
//
|
||||
// Clear all bars
|
||||
//
|
||||
for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
|
||||
PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);
|
||||
}
|
||||
|
||||
//
|
||||
// set the Rom base address: now is hardcode
|
||||
// enable its decoder
|
||||
//
|
||||
Value32 = RomBar | 0x1;
|
||||
PciIoWrite (
|
||||
PciIo,
|
||||
(EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
|
||||
RomBarIndex,
|
||||
1,
|
||||
&Value32
|
||||
);
|
||||
|
||||
//
|
||||
// Programe all upstream bridge
|
||||
//
|
||||
ProgrameUpstreamBridgeForRom(PciDevice, RomBar, TRUE);
|
||||
|
||||
//
|
||||
// Setting the memory space bit in the function's command register
|
||||
//
|
||||
PciEnableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
|
||||
|
||||
} else {
|
||||
|
||||
//
|
||||
// disable command register decode to memory
|
||||
//
|
||||
PciDisableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
|
||||
|
||||
//
|
||||
// Destroy the programmed bar in all the upstream bridge.
|
||||
//
|
||||
ProgrameUpstreamBridgeForRom(PciDevice, RomBar, FALSE);
|
||||
|
||||
//
|
||||
// disable rom decode
|
||||
//
|
||||
Value32 = 0xFFFFFFFE;
|
||||
PciIoWrite (
|
||||
PciIo,
|
||||
(EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
|
||||
RomBarIndex,
|
||||
1,
|
||||
&Value32
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOpRomImage (
|
||||
PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Process the oprom image.
|
||||
|
||||
Arguments:
|
||||
PciDevice A pointer to a pci device.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI Status.
|
||||
|
||||
--*/
|
||||
{
|
||||
UINT8 Indicator;
|
||||
UINT32 ImageSize;
|
||||
UINT16 ImageOffset;
|
||||
VOID *RomBar;
|
||||
UINT8 *RomBarOffset;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS retStatus;
|
||||
BOOLEAN FirstCheck;
|
||||
BOOLEAN SkipImage;
|
||||
UINT32 DestinationSize;
|
||||
UINT32 ScratchSize;
|
||||
UINT8 *Scratch;
|
||||
VOID *ImageBuffer;
|
||||
VOID *DecompressedImageBuffer;
|
||||
UINT32 ImageLength;
|
||||
EFI_DECOMPRESS_PROTOCOL *Decompress;
|
||||
EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
|
||||
PCI_DATA_STRUCTURE *Pcir;
|
||||
|
||||
Indicator = 0;
|
||||
|
||||
//
|
||||
// Get the Address of the Rom image
|
||||
//
|
||||
RomBar = PciDevice->PciIo.RomImage;
|
||||
RomBarOffset = (UINT8 *) RomBar;
|
||||
retStatus = EFI_NOT_FOUND;
|
||||
FirstCheck = TRUE;
|
||||
|
||||
do {
|
||||
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) RomBarOffset;
|
||||
if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
|
||||
RomBarOffset = RomBarOffset + 512;
|
||||
if (FirstCheck) {
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
FirstCheck = FALSE;
|
||||
Pcir = (PCI_DATA_STRUCTURE *) (RomBarOffset + EfiRomHeader->PcirOffset);
|
||||
ImageSize = (UINT32) (Pcir->ImageLength * 512);
|
||||
Indicator = Pcir->Indicator;
|
||||
|
||||
if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
|
||||
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE)) {
|
||||
|
||||
if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
|
||||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) {
|
||||
|
||||
ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
|
||||
ImageSize = (UINT32) (EfiRomHeader->InitializationSize * 512);
|
||||
|
||||
ImageBuffer = (VOID *) (RomBarOffset + ImageOffset);
|
||||
ImageLength = ImageSize - (UINT32)ImageOffset;
|
||||
DecompressedImageBuffer = NULL;
|
||||
|
||||
//
|
||||
// decompress here if needed
|
||||
//
|
||||
SkipImage = FALSE;
|
||||
if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
SkipImage = TRUE;
|
||||
}
|
||||
|
||||
if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
|
||||
Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **) &Decompress);
|
||||
if (EFI_ERROR (Status)) {
|
||||
SkipImage = TRUE;
|
||||
} else {
|
||||
SkipImage = TRUE;
|
||||
Status = Decompress->GetInfo (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&DestinationSize,
|
||||
&ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DecompressedImageBuffer = NULL;
|
||||
DecompressedImageBuffer = AllocatePool (DestinationSize);
|
||||
if (DecompressedImageBuffer != NULL) {
|
||||
Scratch = AllocatePool (ScratchSize);
|
||||
if (Scratch != NULL) {
|
||||
Status = Decompress->Decompress (
|
||||
Decompress,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
DecompressedImageBuffer,
|
||||
DestinationSize,
|
||||
Scratch,
|
||||
ScratchSize
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ImageBuffer = DecompressedImageBuffer;
|
||||
ImageLength = DestinationSize;
|
||||
SkipImage = FALSE;
|
||||
}
|
||||
|
||||
gBS->FreePool (Scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!SkipImage) {
|
||||
//
|
||||
// load image and start image
|
||||
//
|
||||
Status = gBS->LoadImage (
|
||||
FALSE,
|
||||
gPciBusDriverBinding.DriverBindingHandle,
|
||||
PciDevice->Handle,
|
||||
ImageBuffer,
|
||||
ImageLength,
|
||||
&ImageHandle
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = gBS->StartImage (ImageHandle, NULL, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
AddDriver (PciDevice, ImageHandle);
|
||||
PciRomAddImageMapping (
|
||||
ImageHandle,
|
||||
PciDevice->PciRootBridgeIo->SegmentNumber,
|
||||
PciDevice->BusNumber,
|
||||
PciDevice->DeviceNumber,
|
||||
PciDevice->FunctionNumber,
|
||||
(UINT64) (UINTN) PciDevice->PciIo.RomImage,
|
||||
PciDevice->PciIo.RomSize
|
||||
);
|
||||
retStatus = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
} else {
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
}
|
||||
} else {
|
||||
RomBarOffset = RomBarOffset + ImageSize;
|
||||
}
|
||||
|
||||
} while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
|
||||
|
||||
return retStatus;
|
||||
|
||||
}
|
119
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
Normal file
119
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
Normal file
@ -0,0 +1,119 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciOptionRomSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_OP_ROM_SUPPORT_H
|
||||
#define _EFI_PCI_OP_ROM_SUPPORT_H
|
||||
|
||||
EFI_STATUS
|
||||
GetOpRomInfo (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
LoadOpRomImage (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT64 RomBase
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
RomBase - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RomDecode (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT8 RomBarIndex,
|
||||
IN UINT32 RomBar,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
RomBarIndex - TODO: add argument description
|
||||
RomBar - TODO: add argument description
|
||||
Enable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProcessOpRomImage (
|
||||
PCI_IO_DEVICE *PciDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
@ -0,0 +1,83 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciPowerManagement.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
EFI_STATUS
|
||||
ResetPowerManagementFeature (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This function is intended to turn off PWE assertion and
|
||||
put the device to D0 state if the device supports
|
||||
PCI Power Management.
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT8 PowerManagementRegBlock;
|
||||
UINT16 PMCSR;
|
||||
|
||||
PowerManagementRegBlock = 0;
|
||||
|
||||
Status = LocateCapabilityRegBlock (
|
||||
PciIoDevice,
|
||||
EFI_PCI_CAPABILITY_ID_PMI,
|
||||
&PowerManagementRegBlock,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Turn off the PWE assertion and put the device into D0 State
|
||||
//
|
||||
PMCSR = 0x8000;
|
||||
|
||||
//
|
||||
// Write PMCSR
|
||||
//
|
||||
PciIoWrite (
|
||||
&PciIoDevice->PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
PowerManagementRegBlock + 4,
|
||||
1,
|
||||
&PMCSR
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciPowerManagement.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_POWER_MANAGEMENT_H
|
||||
#define _EFI_PCI_POWER_MANAGEMENT_H
|
||||
|
||||
EFI_STATUS
|
||||
ResetPowerManagementFeature (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
2314
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
Normal file
2314
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
Normal file
File diff suppressed because it is too large
Load Diff
740
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
Normal file
740
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
Normal file
@ -0,0 +1,740 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciResourceSupport.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_RESOURCE_SUPPORT_H
|
||||
#define _EFI_PCI_RESOURCE_SUPPORT_H
|
||||
|
||||
#define RESERVED_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('r', 's', 'v', 'd')
|
||||
|
||||
typedef struct {
|
||||
UINT64 Base;
|
||||
UINT64 Length;
|
||||
PCI_BAR_TYPE ResType;
|
||||
} PCI_RESERVED_RESOURCE_NODE;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
PCI_RESERVED_RESOURCE_NODE Node;
|
||||
} PCI_RESERVED_RESOURCE_LIST;
|
||||
|
||||
#define RESOURCED_LIST_FROM_NODE(a) \
|
||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Node, RESERVED_RESOURCE_SIGNATURE)
|
||||
|
||||
#define RESOURCED_LIST_FROM_LINK(a) \
|
||||
CR (a, PCI_RESERVED_RESOURCE_LIST, Link, RESERVED_RESOURCE_SIGNATURE)
|
||||
|
||||
typedef enum {
|
||||
PciResUsageTypical = 0,
|
||||
PciResUsagePadding,
|
||||
PciResUsageOptionRomProcessing
|
||||
} PCI_RESOURCE_USAGE;
|
||||
|
||||
#define PCI_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'r', 'c')
|
||||
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
LIST_ENTRY ChildList;
|
||||
PCI_IO_DEVICE *PciDev;
|
||||
UINT64 Alignment;
|
||||
UINT64 Offset;
|
||||
UINT8 Bar;
|
||||
PCI_BAR_TYPE ResType;
|
||||
UINT64 Length;
|
||||
BOOLEAN Reserved;
|
||||
PCI_RESOURCE_USAGE ResourceUsage;
|
||||
} PCI_RESOURCE_NODE;
|
||||
|
||||
#define RESOURCE_NODE_FROM_LINK(a) \
|
||||
CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
|
||||
|
||||
EFI_STATUS
|
||||
SkipVGAAperture (
|
||||
OUT UINT64 *Start,
|
||||
IN UINT64 Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Start - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
SkipIsaAliasAperture (
|
||||
OUT UINT64 *Start,
|
||||
IN UINT64 Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Start - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InsertResourceNode (
|
||||
PCI_RESOURCE_NODE *Bridge,
|
||||
PCI_RESOURCE_NODE *ResNode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
ResNode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
MergeResourceTree (
|
||||
PCI_RESOURCE_NODE *Dst,
|
||||
PCI_RESOURCE_NODE *Res,
|
||||
BOOLEAN TypeMerge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Dst - TODO: add argument description
|
||||
Res - TODO: add argument description
|
||||
TypeMerge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CalculateApertureIo16 (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CalculateResourceAperture (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceFromDevice (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
PCI_RESOURCE_NODE *
|
||||
CreateResourceNode (
|
||||
IN PCI_IO_DEVICE *PciDev,
|
||||
IN UINT64 Length,
|
||||
IN UINT64 Alignment,
|
||||
IN UINT8 Bar,
|
||||
IN PCI_BAR_TYPE ResType,
|
||||
IN PCI_RESOURCE_USAGE ResUsage
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
Alignment - TODO: add argument description
|
||||
Bar - TODO: add argument description
|
||||
ResType - TODO: add argument description
|
||||
ResUsage - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
CreateResourceMap (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *IoNode,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResourcePaddingPolicy (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DegradeResource (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN PCI_RESOURCE_NODE *Mem32Node,
|
||||
IN PCI_RESOURCE_NODE *PMem32Node,
|
||||
IN PCI_RESOURCE_NODE *Mem64Node,
|
||||
IN PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
BridgeSupportResourceDecode (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT32 Decode
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
Decode - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramResource (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramBar (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramPpbApperture (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgrameUpstreamBridgeForRom (
|
||||
IN PCI_IO_DEVICE *PciDevice,
|
||||
IN UINT32 OptionRomBase,
|
||||
IN BOOLEAN Enable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDevice - TODO: add argument description
|
||||
OptionRomBase - TODO: add argument description
|
||||
Enable - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
ResourceRequestExisted (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
InitializeResourcePool (
|
||||
PCI_RESOURCE_NODE *ResourcePool,
|
||||
PCI_BAR_TYPE ResourceType
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ResourcePool - TODO: add argument description
|
||||
ResourceType - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
GetResourceMap (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE **IoBridge,
|
||||
PCI_RESOURCE_NODE **Mem32Bridge,
|
||||
PCI_RESOURCE_NODE **PMem32Bridge,
|
||||
PCI_RESOURCE_NODE **Mem64Bridge,
|
||||
PCI_RESOURCE_NODE **PMem64Bridge,
|
||||
PCI_RESOURCE_NODE *IoPool,
|
||||
PCI_RESOURCE_NODE *Mem32Pool,
|
||||
PCI_RESOURCE_NODE *PMem32Pool,
|
||||
PCI_RESOURCE_NODE *Mem64Pool,
|
||||
PCI_RESOURCE_NODE *PMem64Pool
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoBridge - TODO: add argument description
|
||||
Mem32Bridge - TODO: add argument description
|
||||
PMem32Bridge - TODO: add argument description
|
||||
Mem64Bridge - TODO: add argument description
|
||||
PMem64Bridge - TODO: add argument description
|
||||
IoPool - TODO: add argument description
|
||||
Mem32Pool - TODO: add argument description
|
||||
PMem32Pool - TODO: add argument description
|
||||
Mem64Pool - TODO: add argument description
|
||||
PMem64Pool - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
DestroyResourceTree (
|
||||
IN PCI_RESOURCE_NODE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
RecordReservedResource (
|
||||
IN UINT64 Base,
|
||||
IN UINT64 Length,
|
||||
IN PCI_BAR_TYPE ResType,
|
||||
IN PCI_IO_DEVICE *Bridge
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Length - TODO: add argument description
|
||||
ResType - TODO: add argument description
|
||||
Bridge - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResourcePaddingForCardBusBridge (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ProgramP2C (
|
||||
IN UINT64 Base,
|
||||
IN PCI_RESOURCE_NODE *Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
Base - TODO: add argument description
|
||||
Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ApplyResourcePadding (
|
||||
PCI_IO_DEVICE *PciDev,
|
||||
PCI_RESOURCE_NODE *IoNode,
|
||||
PCI_RESOURCE_NODE *Mem32Node,
|
||||
PCI_RESOURCE_NODE *PMem32Node,
|
||||
PCI_RESOURCE_NODE *Mem64Node,
|
||||
PCI_RESOURCE_NODE *PMem64Node
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciDev - TODO: add argument description
|
||||
IoNode - TODO: add argument description
|
||||
Mem32Node - TODO: add argument description
|
||||
PMem32Node - TODO: add argument description
|
||||
Mem64Node - TODO: add argument description
|
||||
PMem64Node - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
VOID
|
||||
GetResourcePaddingPpb (
|
||||
IN PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
ResetAllPpbBusReg (
|
||||
IN PCI_IO_DEVICE *Bridge,
|
||||
IN UINT8 StartBusNumber
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Reset bus register
|
||||
|
||||
Arguments:
|
||||
|
||||
Bridge - a pointer to the PCI_IO_DEVICE
|
||||
StartBusNumber - the number of bus
|
||||
|
||||
Returns:
|
||||
|
||||
None
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
197
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
Normal file
197
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
Normal file
@ -0,0 +1,197 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciRomTable.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Option Rom Support for PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
#include "PciRomTable.h"
|
||||
|
||||
typedef struct {
|
||||
EFI_HANDLE ImageHandle;
|
||||
UINTN Seg;
|
||||
UINT8 Bus;
|
||||
UINT8 Dev;
|
||||
UINT8 Func;
|
||||
UINT64 RomAddress;
|
||||
UINT64 RomLength;
|
||||
} EFI_PCI_ROM_IMAGE_MAPPING;
|
||||
|
||||
static UINTN mNumberOfPciRomImages = 0;
|
||||
static UINTN mMaxNumberOfPciRomImages = 0;
|
||||
static EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL;
|
||||
|
||||
VOID
|
||||
PciRomAddImageMapping (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN Seg,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Dev,
|
||||
IN UINT8 Func,
|
||||
IN UINT64 RomAddress,
|
||||
IN UINT64 RomLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
Seg - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Dev - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
RomAddress - TODO: add argument description
|
||||
RomLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
|
||||
|
||||
if (mNumberOfPciRomImages >= mMaxNumberOfPciRomImages) {
|
||||
|
||||
mMaxNumberOfPciRomImages += 0x20;
|
||||
|
||||
TempMapping = NULL;
|
||||
TempMapping = AllocatePool (mMaxNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
|
||||
if (TempMapping == NULL) {
|
||||
return ;
|
||||
}
|
||||
|
||||
CopyMem (TempMapping, mRomImageTable, mNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
|
||||
|
||||
if (mRomImageTable != NULL) {
|
||||
gBS->FreePool (mRomImageTable);
|
||||
}
|
||||
|
||||
mRomImageTable = TempMapping;
|
||||
}
|
||||
|
||||
mRomImageTable[mNumberOfPciRomImages].ImageHandle = ImageHandle;
|
||||
mRomImageTable[mNumberOfPciRomImages].Seg = Seg;
|
||||
mRomImageTable[mNumberOfPciRomImages].Bus = Bus;
|
||||
mRomImageTable[mNumberOfPciRomImages].Dev = Dev;
|
||||
mRomImageTable[mNumberOfPciRomImages].Func = Func;
|
||||
mRomImageTable[mNumberOfPciRomImages].RomAddress = RomAddress;
|
||||
mRomImageTable[mNumberOfPciRomImages].RomLength = RomLength;
|
||||
mNumberOfPciRomImages++;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetRomResourceFromPciOptionRomTable (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: PciRootBridgeIo - add argument and description to function comment
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_NOT_FOUND - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_OPTION_ROM_TABLE *PciOptionRomTable;
|
||||
EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor;
|
||||
UINTN Index;
|
||||
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiPciOptionRomTableGuid, (VOID **) &PciOptionRomTable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
for (Index = 0; Index < PciOptionRomTable->PciOptionRomCount; Index++) {
|
||||
PciOptionRomDescriptor = &PciOptionRomTable->PciOptionRomDescriptors[Index];
|
||||
if (PciOptionRomDescriptor->Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
PciOptionRomDescriptor->Bus == PciIoDevice->BusNumber &&
|
||||
PciOptionRomDescriptor->Dev == PciIoDevice->DeviceNumber &&
|
||||
PciOptionRomDescriptor->Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) PciOptionRomDescriptor->RomAddress;
|
||||
PciIoDevice->PciIo.RomSize = (UINTN) PciOptionRomDescriptor->RomLength;
|
||||
}
|
||||
}
|
||||
|
||||
for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
|
||||
if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
|
||||
mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
|
||||
mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetImageMapping (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Arguments:
|
||||
|
||||
Returns:
|
||||
|
||||
--*/
|
||||
// TODO: PciIoDevice - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
UINTN Index;
|
||||
|
||||
PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
|
||||
|
||||
for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
|
||||
if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
|
||||
mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
|
||||
mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
|
||||
mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
|
||||
|
||||
if (mRomImageTable[Index].ImageHandle != NULL) {
|
||||
AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
|
||||
} else {
|
||||
PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) mRomImageTable[Index].RomAddress;
|
||||
PciIoDevice->PciIo.RomSize = (UINTN) mRomImageTable[Index].RomLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
107
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
Normal file
107
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*++
|
||||
|
||||
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:
|
||||
|
||||
PciRomTable.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Option Rom Support for PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_ROM_TABLE_H
|
||||
#define _EFI_PCI_ROM_TABLE_H
|
||||
|
||||
VOID
|
||||
PciRomAddImageMapping (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN UINTN Seg,
|
||||
IN UINT8 Bus,
|
||||
IN UINT8 Dev,
|
||||
IN UINT8 Func,
|
||||
IN UINT64 RomAddress,
|
||||
IN UINT64 RomLength
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
ImageHandle - TODO: add argument description
|
||||
Seg - TODO: add argument description
|
||||
Bus - TODO: add argument description
|
||||
Dev - TODO: add argument description
|
||||
Func - TODO: add argument description
|
||||
RomAddress - TODO: add argument description
|
||||
RomLength - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetRomResourceFromPciOptionRomTable (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
This - TODO: add argument description
|
||||
PciRootBridgeIo - TODO: add argument description
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
PciRomGetImageMapping (
|
||||
PCI_IO_DEVICE *PciIoDevice
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
TODO: Add function description
|
||||
|
||||
Arguments:
|
||||
|
||||
PciIoDevice - TODO: add argument description
|
||||
|
||||
Returns:
|
||||
|
||||
TODO: add return values
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
347
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
Normal file
347
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
Normal file
@ -0,0 +1,347 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
PciBus.c
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "pcibus.h"
|
||||
|
||||
//
|
||||
// PCI Bus Driver Global Variables
|
||||
//
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding = {
|
||||
PciBusDriverBindingSupported,
|
||||
PciBusDriverBindingStart,
|
||||
PciBusDriverBindingStop,
|
||||
0xa,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
|
||||
UINTN gPciHostBridgeNumber;
|
||||
BOOLEAN gFullEnumeration;
|
||||
UINT64 gAllOne = 0xFFFFFFFFFFFFFFFFULL;
|
||||
UINT64 gAllZero = 0;
|
||||
|
||||
EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
||||
|
||||
//
|
||||
// PCI Bus Driver Support Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initialize the global variables
|
||||
publish the driver binding protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
EFI_DEVICE_ERROR
|
||||
|
||||
--*/
|
||||
// TODO: ImageHandle - add argument and description to function comment
|
||||
// TODO: SystemTable - add argument and description to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
InitializePciDevicePool ();
|
||||
|
||||
gFullEnumeration = TRUE;
|
||||
|
||||
gPciHostBridgeNumber = 0;
|
||||
|
||||
//
|
||||
// Install driver model protocol(s).
|
||||
//
|
||||
Status = EfiLibInstallAllDriverProtocols (
|
||||
ImageHandle,
|
||||
SystemTable,
|
||||
&gPciBusDriverBinding,
|
||||
ImageHandle,
|
||||
&gPciBusComponentName,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
InstallHotPlugRequestProtocol (&Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Check to see if pci bus driver supports the given controller
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
// TODO: EFI_UNSUPPORTED - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
EFI_DEV_PATH_PTR Node;
|
||||
|
||||
if (RemainingDevicePath != NULL) {
|
||||
Node.DevPath = RemainingDevicePath;
|
||||
if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
|
||||
Node.DevPath->SubType != HW_PCI_DP ||
|
||||
DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Open the IO Abstraction(s) needed to perform the supported test
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
(VOID **) &ParentDevicePath,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
(VOID **) &PciRootBridgeIo,
|
||||
This->DriverBindingHandle,
|
||||
Controller,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (Status == EFI_ALREADY_STARTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Start to management the controller passed in
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: RemainingDevicePath - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// If PCI Platform protocol is available, get it now.
|
||||
// If the platform implements this, it must be installed before BDS phase
|
||||
//
|
||||
gPciPlatformProtocol = NULL;
|
||||
gBS->LocateProtocol (
|
||||
&gEfiPciPlatformProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &gPciPlatformProtocol
|
||||
);
|
||||
|
||||
gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
|
||||
|
||||
//
|
||||
// Enumerate the entire host bridge
|
||||
// After enumeration, a database that records all the device information will be created
|
||||
//
|
||||
//
|
||||
Status = PciEnumerator (Controller);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable PCI device specified by remaining device path. BDS or other driver can call the
|
||||
// start more than once.
|
||||
//
|
||||
|
||||
StartPciDevices (Controller, RemainingDevicePath);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Stop one or more children created at start of pci bus driver
|
||||
if all the the children get closed, close the protocol
|
||||
|
||||
Arguments:
|
||||
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
--*/
|
||||
// TODO: This - add argument and description to function comment
|
||||
// TODO: Controller - add argument and description to function comment
|
||||
// TODO: NumberOfChildren - add argument and description to function comment
|
||||
// TODO: ChildHandleBuffer - add argument and description to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
// TODO: EFI_DEVICE_ERROR - add return value to function comment
|
||||
// TODO: EFI_SUCCESS - add return value to function comment
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
BOOLEAN AllChildrenStopped;
|
||||
|
||||
if (NumberOfChildren == 0) {
|
||||
//
|
||||
// Close the bus driver
|
||||
//
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
&gEfiPciRootBridgeIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
Controller
|
||||
);
|
||||
|
||||
DestroyRootBridgeByHandle (
|
||||
Controller
|
||||
);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Stop all the children
|
||||
//
|
||||
|
||||
AllChildrenStopped = TRUE;
|
||||
|
||||
for (Index = 0; Index < NumberOfChildren; Index++) {
|
||||
|
||||
//
|
||||
// De register all the pci device
|
||||
//
|
||||
Status = DeRegisterPciDevice (Controller, ChildHandleBuffer[Index]);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
AllChildrenStopped = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!AllChildrenStopped) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
305
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
Normal file
305
IntelFrameworkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
Normal file
@ -0,0 +1,305 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name:
|
||||
|
||||
pcibus.h
|
||||
|
||||
Abstract:
|
||||
|
||||
PCI Bus Driver
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_PCI_BUS_H
|
||||
#define _EFI_PCI_BUS_H
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiDxe.h>
|
||||
#include <Common/FrameworkStatusCode.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/PciHostBridgeResourceAllocation.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Guid/PciHotplugDevice.h>
|
||||
#include <Protocol/PciRootBridgeIo.h>
|
||||
#include <Protocol/PciHotPlugRequest.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/PciPlatform.h>
|
||||
#include <Protocol/PciHotPlugInit.h>
|
||||
#include <Protocol/Decompress.h>
|
||||
#include <Guid/PciOptionRomTable.h>
|
||||
#include <Protocol/BusSpecificDriverOverride.h>
|
||||
#include <Protocol/UgaIo.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PciIncompatibleDeviceSupportLib.h>
|
||||
|
||||
#include <IndustryStandard/pci22.h>
|
||||
#include <IndustryStandard/Acpi.h>
|
||||
#include "ComponentName.h"
|
||||
|
||||
//
|
||||
// Driver Produced Protocol Prototypes
|
||||
//
|
||||
|
||||
#define VGABASE1 0x3B0
|
||||
#define VGALIMIT1 0x3BB
|
||||
|
||||
#define VGABASE2 0x3C0
|
||||
#define VGALIMIT2 0x3DF
|
||||
|
||||
#define ISABASE 0x100
|
||||
#define ISALIMIT 0x3FF
|
||||
|
||||
typedef enum {
|
||||
PciBarTypeUnknown = 0,
|
||||
PciBarTypeIo16,
|
||||
PciBarTypeIo32,
|
||||
PciBarTypeMem32,
|
||||
PciBarTypePMem32,
|
||||
PciBarTypeMem64,
|
||||
PciBarTypePMem64,
|
||||
PciBarTypeIo,
|
||||
PciBarTypeMem,
|
||||
PciBarTypeMaxType
|
||||
} PCI_BAR_TYPE;
|
||||
|
||||
typedef struct {
|
||||
UINT64 BaseAddress;
|
||||
UINT64 Length;
|
||||
UINT64 Alignment;
|
||||
PCI_BAR_TYPE BarType;
|
||||
BOOLEAN Prefetchable;
|
||||
UINT8 MemType;
|
||||
UINT8 Offset;
|
||||
} PCI_BAR;
|
||||
|
||||
#define PPB_BAR_0 0
|
||||
#define PPB_BAR_1 1
|
||||
#define PPB_IO_RANGE 2
|
||||
#define PPB_MEM32_RANGE 3
|
||||
#define PPB_PMEM32_RANGE 4
|
||||
#define PPB_PMEM64_RANGE 5
|
||||
#define PPB_MEM64_RANGE 0xFF
|
||||
|
||||
#define P2C_BAR_0 0
|
||||
#define P2C_MEM_1 1
|
||||
#define P2C_MEM_2 2
|
||||
#define P2C_IO_1 3
|
||||
#define P2C_IO_2 4
|
||||
|
||||
#define PCI_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'i', 'o')
|
||||
|
||||
#define EFI_BRIDGE_IO32_DECODE_SUPPORTED 0x0001
|
||||
#define EFI_BRIDGE_PMEM32_DECODE_SUPPORTED 0x0002
|
||||
#define EFI_BRIDGE_PMEM64_DECODE_SUPPORTED 0x0004
|
||||
#define EFI_BRIDGE_IO16_DECODE_SUPPORTED 0x0008
|
||||
#define EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED 0x0010
|
||||
#define EFI_BRIDGE_MEM64_DECODE_SUPPORTED 0x0020
|
||||
#define EFI_BRIDGE_MEM32_DECODE_SUPPORTED 0x0040
|
||||
|
||||
#define PCI_MAX_HOST_BRIDGE_NUM 0x0010
|
||||
//
|
||||
// Define resource status constant
|
||||
//
|
||||
#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
|
||||
#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
|
||||
#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
|
||||
|
||||
//
|
||||
// Define option for attribute
|
||||
//
|
||||
#define EFI_SET_SUPPORTS 0
|
||||
#define EFI_SET_ATTRIBUTES 1
|
||||
|
||||
typedef struct _PCI_IO_DEVICE {
|
||||
UINT32 Signature;
|
||||
EFI_HANDLE Handle;
|
||||
EFI_PCI_IO_PROTOCOL PciIo;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL PciDriverOverride;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
|
||||
|
||||
//
|
||||
// PCI configuration space header type
|
||||
//
|
||||
PCI_TYPE00 Pci;
|
||||
|
||||
//
|
||||
// Bus number, Device number, Function number
|
||||
//
|
||||
UINT8 BusNumber;
|
||||
UINT8 DeviceNumber;
|
||||
UINT8 FunctionNumber;
|
||||
|
||||
//
|
||||
// BAR for this PCI Device
|
||||
//
|
||||
PCI_BAR PciBar[PCI_MAX_BAR];
|
||||
|
||||
//
|
||||
// The bridge device this pci device is subject to
|
||||
//
|
||||
struct _PCI_IO_DEVICE *Parent;
|
||||
|
||||
//
|
||||
// A linked list for children Pci Device if it is bridge device
|
||||
//
|
||||
LIST_ENTRY ChildList;
|
||||
|
||||
//
|
||||
// TURE if the PCI bus driver creates the handle for this PCI device
|
||||
//
|
||||
BOOLEAN Registered;
|
||||
|
||||
//
|
||||
// TRUE if the PCI bus driver successfully allocates the resource required by
|
||||
// this PCI device
|
||||
//
|
||||
BOOLEAN Allocated;
|
||||
|
||||
//
|
||||
// The attribute this PCI device currently set
|
||||
//
|
||||
UINT64 Attributes;
|
||||
|
||||
//
|
||||
// The attributes this PCI device actually supports
|
||||
//
|
||||
UINT64 Supports;
|
||||
|
||||
//
|
||||
// The resource decode the bridge supports
|
||||
//
|
||||
UINT32 Decodes;
|
||||
|
||||
//
|
||||
// The OptionRom Size
|
||||
//
|
||||
UINT64 RomSize;
|
||||
|
||||
//
|
||||
// The OptionRom Size
|
||||
//
|
||||
UINT64 RomBase;
|
||||
|
||||
//
|
||||
// TRUE if all OpROM (in device or in platform specific position) have been processed
|
||||
//
|
||||
BOOLEAN AllOpRomProcessed;
|
||||
|
||||
//
|
||||
// TRUE if there is any EFI driver in the OptionRom
|
||||
//
|
||||
BOOLEAN BusOverride;
|
||||
|
||||
//
|
||||
// A list tracking reserved resource on a bridge device
|
||||
//
|
||||
LIST_ENTRY ReservedResourceList;
|
||||
|
||||
//
|
||||
// A list tracking image handle of platform specific overriding driver
|
||||
//
|
||||
LIST_ENTRY OptionRomDriverList;
|
||||
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ResourcePaddingDescriptors;
|
||||
EFI_HPC_PADDING_ATTRIBUTES PaddingAttributes;
|
||||
|
||||
BOOLEAN IsPciExp;
|
||||
|
||||
} PCI_IO_DEVICE;
|
||||
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \
|
||||
CR (a, PCI_IO_DEVICE, PciIo, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS(a) \
|
||||
CR (a, PCI_IO_DEVICE, PciDriverOverride, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
#define PCI_IO_DEVICE_FROM_LINK(a) \
|
||||
CR (a, PCI_IO_DEVICE, Link, PCI_IO_DEVICE_SIGNATURE)
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
|
||||
extern LIST_ENTRY gPciDevicePool;
|
||||
extern BOOLEAN gFullEnumeration;
|
||||
extern UINTN gPciHostBridgeNumber;
|
||||
extern EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
|
||||
extern UINT64 gAllOne;
|
||||
extern UINT64 gAllZero;
|
||||
|
||||
extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
|
||||
|
||||
#include "PciIo.h"
|
||||
#include "PciCommand.h"
|
||||
#include "PciDeviceSupport.h"
|
||||
#include "PciEnumerator.h"
|
||||
#include "PciEnumeratorSupport.h"
|
||||
#include "PciDriverOverride.h"
|
||||
#include "PciRomTable.h"
|
||||
#include "PciOptionRomSupport.h"
|
||||
#include "PciPowerManagement.h"
|
||||
#include "PciHotPlugSupport.h"
|
||||
#include "PciLib.h"
|
||||
|
||||
//
|
||||
// PCI Bus Support Function Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PciBusDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
#endif
|
@ -30,6 +30,38 @@
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
|
||||
[LibraryClasses.common]
|
||||
CacheMaintenanceLib|${WORKSPACE}/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
|
||||
DebugLib|${WORKSPACE}/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
BaseLib|${WORKSPACE}/MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|${WORKSPACE}/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
PciCf8Lib|${WORKSPACE}/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
|
||||
PciExpressLib|${WORKSPACE}/MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
|
||||
PciLib|${WORKSPACE}/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
|
||||
PeCoffGetEntryPoint|${WORKSPACE}/MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
PeCoffLib|${WORKSPACE}/MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PerformanceLib|${WORKSPACE}/MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
|
||||
PostCodeLib|${WORKSPACE}/MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf
|
||||
PostCodeLib|${WORKSPACE}/MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
|
||||
PrintLib|${WORKSPACE}/MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
TimerLib|${WORKSPACE}/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
UefiDecompressLib|${WORKSPACE}/MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
HobLib|${WORKSPACE}/MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
MemoryAllocationLib|${WORKSPACE}/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
|
||||
PcdLib|${WORKSPACE}/MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
DxeServiceTableLib|${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
SmbusLib|${WORKSPACE}/MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
|
||||
UefiBootServicesTableLib|${WORKSPACE}/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
DebugLib|${WORKSPACE}/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
|
||||
DevicePathLib|${WORKSPACE}/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiDriverEntryPoint|${WORKSPACE}/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiLib|${WORKSPACE}/MdePkg/Library/UefiLib/UefiLib.inf
|
||||
UefiRuntimeServicesTableLib|${WORKSPACE}/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
DxeServicesTableLib|${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
FvbServiceLib|${WORKSPACE}/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf
|
||||
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -88,4 +120,6 @@
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Library\OemHookStatusCodeLibNull\OemHookStatusCodeLibNull.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Library\PciIncompatibleDeviceSupportLib\PciIncompatibleDeviceSupportLib.inf
|
||||
#$(WORKSPACE)\IntelFrameworkModulePkg\Bus\Pci\PciBus\Dxe\PciBus.inf
|
||||
#$(WORKSPACE)\IntelFrameworkModulePkg\Bus\Pci\IdeBus\Dxe\IdeBus.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Bus\Pci\IdeBus\Dxe\IdeBus.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHub\Dxe\DataHub.inf
|
||||
$(WORKSPACE)\IntelFrameworkModulePkg\Universal\DataHub\DataHubStdErr\Dxe\DataHubStdErr.inf
|
||||
|
Reference in New Issue
Block a user