Adjust directory structures.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3322 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
210
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ComponentName.c
Normal file
210
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/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/IdeBusDxe/ComponentName.h
Normal file
80
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/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/IdeBusDxe/DriverConfiguration.c
Normal file
322
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/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/IdeBusDxe/DriverDiagnostics.c
Normal file
200
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/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;
|
||||
}
|
123
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdebusDxe.inf
Normal file
123
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdebusDxe.inf
Normal file
@@ -0,0 +1,123 @@
|
||||
#/** @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 = IdeBusDxe
|
||||
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
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# 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/IdeBusDxe/IdebusDxe.msa
Normal file
114
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdebusDxe.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>
|
2624
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c
Normal file
2624
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ata.c
Normal file
File diff suppressed because it is too large
Load Diff
2140
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/atapi.c
Normal file
2140
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/atapi.c
Normal file
File diff suppressed because it is too large
Load Diff
1824
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ide.c
Normal file
1824
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ide.c
Normal file
File diff suppressed because it is too large
Load Diff
1328
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ide.h
Normal file
1328
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/ide.h
Normal file
File diff suppressed because it is too large
Load Diff
1413
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c
Normal file
1413
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c
Normal file
File diff suppressed because it is too large
Load Diff
419
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.h
Normal file
419
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.h
Normal file
@@ -0,0 +1,419 @@
|
||||
/** @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 <FrameworkDxe.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;
|
||||
|
||||
ATAPI_INQUIRY_DATA *pInquiryData;
|
||||
EFI_IDENTIFY_DATA *pIdData;
|
||||
ATA_PIO_MODE PioMode;
|
||||
EFI_ATA_MODE UdmaMode;
|
||||
CHAR8 ModelName[41];
|
||||
ATAPI_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
|
311
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idedata.h
Normal file
311
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idedata.h
Normal file
@@ -0,0 +1,311 @@
|
||||
/** @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
|
||||
|
||||
#include <IndustryStandard/Atapi.h>
|
||||
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
//
|
||||
// ATAPI6 related data structure definition
|
||||
//
|
||||
|
||||
//
|
||||
// The maximum sectors count in 28 bit addressing mode
|
||||
//
|
||||
#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT32 RegionBaseAddr;
|
||||
UINT16 ByteCount;
|
||||
UINT16 EndOfTable;
|
||||
} IDE_DMA_PRD;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define SETFEATURE TRUE
|
||||
#define CLEARFEATURE FALSE
|
||||
|
||||
//
|
||||
// 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
|
Reference in New Issue
Block a user