Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3997 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8
2007-09-30 02:32:16 +00:00
parent f3d08ccf1a
commit 733f03aa90
10 changed files with 1200 additions and 773 deletions

View File

@@ -15,42 +15,69 @@
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = { EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = {
IDEBusComponentNameGetDriverName, IDEBusComponentNameGetDriverName,
IDEBusComponentNameGetControllerName, IDEBusComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gIDEBusComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IDEBusComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IDEBusComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" }, { "eng;en", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },
{ NULL , NULL } { NULL , NULL }
}; };
STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {
{ "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" }, { "eng;en", (CHAR16 *) L"PCI IDE/ATAPI Controller" },
{ NULL , NULL } { NULL , NULL }
}; };
/** /**
Retrieves a Unicode string that is the user readable name of the EFI Driver. Retrieves a Unicode string that is the user readable name of the driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. This function retrieves the user readable name of a driver in the form of a
@param Language A pointer to a three character ISO 639-2 language identifier. Unicode string. If the driver specified by This has a user readable name in
This is the language of the driver name that that the caller the language specified by Language, then a pointer to the driver name is
is requesting, and it must match one of the languages specified returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
in SupportedLanguages. The number of languages supported by a by This does not support the language specified by Language,
driver is up to the driver writer. then EFI_UNSUPPORTED is returned.
@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 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
and the language specified by Language was returned EFI_COMPONENT_NAME_PROTOCOL instance.
in DriverName.
@retval EFI_INVALID_PARAMETER Language is NULL. @param Language[in] A pointer to a Null-terminated ASCII string
@retval EFI_INVALID_PARAMETER DriverName is NULL. array indicating the language. This is the
@retval EFI_UNSUPPORTED The driver specified by This does not support the language of the driver name that the caller is
language specified by Language. 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. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] 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 EFI_STATUS
@@ -61,53 +88,81 @@ IDEBusComponentNameGetDriverName (
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) )
{ {
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gIDEBusComponentName.SupportedLanguages, This->SupportedLanguages,
mIDEBusDriverNameTable, mIDEBusDriverNameTable,
DriverName DriverName,
); (BOOLEAN)(This == &gIDEBusComponentName)
);
} }
/** /**
Retrieves a Unicode string that is the user readable name of the controller Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver. that is being managed by a driver.
@param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. This function retrieves the user readable name of the controller specified by
@param ControllerHandle The handle of a controller that the driver specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the
This is managing. This handle specifies the controller driver specified by This has a user readable name in the language specified by
whose name is to be returned. Language, then a pointer to the controller name is returned in ControllerName,
@param ChildHandle The handle of the child controller to retrieve the name and EFI_SUCCESS is returned. If the driver specified by This is not currently
of. This is an optional parameter that may be NULL. It managing the controller specified by ControllerHandle and ChildHandle,
will be NULL for device drivers. It will also be NULL then EFI_UNSUPPORTED is returned. If the driver specified by This does not
for a bus drivers that wish to retrieve the name of the support the language specified by Language, then EFI_UNSUPPORTED is returned.
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 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
language specified by Language for the driver EFI_COMPONENT_NAME_PROTOCOL instance.
specified by This was returned in DriverName.
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. @param ControllerHandle[in] The handle of a controller that the driver
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid specified by This is managing. This handle
EFI_HANDLE. specifies the controller whose name is to be
@retval EFI_INVALID_PARAMETER Language is NULL. returned.
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
@retval EFI_UNSUPPORTED The driver specified by This is not currently @param ChildHandle[in] The handle of the child controller to retrieve
managing the controller specified by the name of. This is an optional parameter that
ControllerHandle and ChildHandle. may be NULL. It will be NULL for device
@retval EFI_UNSUPPORTED The driver specified by This does not support the drivers. It will also be NULL for a bus drivers
language specified by Language. 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[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] 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 EFI_STATUS
@@ -137,12 +192,13 @@ IDEBusComponentNameGetControllerName (
} }
if (ChildHandle == NULL) { if (ChildHandle == NULL) {
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gIDEBusComponentName.SupportedLanguages, This->SupportedLanguages,
mIDEBusControllerNameTable, mIDEBusControllerNameTable,
ControllerName ControllerName,
); (BOOLEAN)(This == &gIDEBusComponentName)
);
} }
Status = EfiTestChildHandle ( Status = EfiTestChildHandle (
@@ -171,12 +227,13 @@ IDEBusComponentNameGetControllerName (
IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo); IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);
return LookupUnicodeString ( return LookupUnicodeString2 (
Language, Language,
gIDEBusComponentName.SupportedLanguages, This->SupportedLanguages,
IdeBlkIoDevice->ControllerNameTable, IdeBlkIoDevice->ControllerNameTable,
ControllerName ControllerName,
); (BOOLEAN)(This == &gIDEBusComponentName)
);
} }
/** /**
@@ -201,10 +258,19 @@ AddName (
ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex]; ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];
} }
AddUnicodeString ( AddUnicodeString2 (
"eng", "eng",
gIDEBusComponentName.SupportedLanguages, gIDEBusComponentName.SupportedLanguages,
&IdeBlkIoDevicePtr->ControllerNameTable, &IdeBlkIoDevicePtr->ControllerNameTable,
ModelName ModelName,
TRUE
); );
AddUnicodeString2 (
"en",
gIDEBusComponentName2.SupportedLanguages,
&IdeBlkIoDevicePtr->ControllerNameTable,
ModelName,
FALSE
);
} }

View File

@@ -15,20 +15,50 @@
#define ADD_NAME(x) AddName ((x)); #define ADD_NAME(x) AddName ((x));
extern EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gIDEBusComponentName2;
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
/** /**
TODO: Add function description Retrieves a Unicode string that is the user readable name of the driver.
@param This TODO: add argument description This function retrieves the user readable name of a driver in the form of a
@param Language TODO: add argument description Unicode string. If the driver specified by This has a user readable name in
@param DriverName TODO: add argument description the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
TODO: add return values @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] 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 EFI_STATUS
@@ -37,19 +67,75 @@ IDEBusComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) );
;
/** /**
TODO: Add function description Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@param This TODO: add argument description This function retrieves the user readable name of the controller specified by
@param ControllerHandle TODO: add argument description ControllerHandle and ChildHandle in the form of a Unicode string. If the
@param ChildHandle TODO: add argument description driver specified by This has a user readable name in the language specified by
@param Language TODO: add argument description Language, then a pointer to the controller name is returned in ControllerName,
@param ControllerName TODO: add argument description and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
TODO: add return values @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] 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[in] 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[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] 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 EFI_STATUS
@@ -60,8 +146,8 @@ IDEBusComponentNameGetControllerName (
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName OUT CHAR16 **ControllerName
) );
;
/** /**
TODO: Add function description TODO: Add function description

View File

@@ -1398,14 +1398,13 @@ InitializeIdeBus(
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gIDEBusDriverBinding, &gIDEBusDriverBinding,
ImageHandle, ImageHandle,
&gIDEBusComponentName, &gIDEBusComponentName,
NULL, &gIDEBusComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@@ -16,17 +16,66 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// //
// EFI Component Name Protocol // EFI Component Name Protocol
// //
EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName = { EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName = {
PciBusComponentNameGetDriverName, PciBusComponentNameGetDriverName,
PciBusComponentNameGetControllerName, PciBusComponentNameGetControllerName,
"eng" "eng"
}; };
//
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPciBusComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PciBusComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PciBusComponentNameGetControllerName,
"en"
};
STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = { STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = {
{ "eng", (CHAR16 *) L"PCI Bus Driver" }, { "eng;en", (CHAR16 *) L"PCI Bus Driver" },
{ NULL , NULL } { NULL , NULL }
}; };
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] 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 EFI_STATUS
EFIAPI EFIAPI
PciBusComponentNameGetDriverName ( PciBusComponentNameGetDriverName (
@@ -34,41 +83,84 @@ PciBusComponentNameGetDriverName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName 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 ( return LookupUnicodeString2 (
Language, Language,
gPciBusComponentName.SupportedLanguages, This->SupportedLanguages,
mPciBusDriverNameTable, mPciBusDriverNameTable,
DriverName DriverName,
); (BOOLEAN)(This == &gPciBusComponentName)
);
} }
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] 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[in] 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[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] 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 EFI_STATUS
EFIAPI EFIAPI
PciBusComponentNameGetControllerName ( PciBusComponentNameGetControllerName (
@@ -78,50 +170,6 @@ PciBusComponentNameGetControllerName (
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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; return EFI_UNSUPPORTED;
} }

View File

@@ -15,37 +15,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _EFI_PCI_BUS_COMPONENT_NAME_H #ifndef _EFI_PCI_BUS_COMPONENT_NAME_H
#define _EFI_PCI_BUS_COMPONENT_NAME_H #define _EFI_PCI_BUS_COMPONENT_NAME_H
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPciBusComponentName2;
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] 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 EFI_STATUS
EFIAPI EFIAPI
PciBusComponentNameGetDriverName ( PciBusComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **DriverName OUT CHAR16 **DriverName
) );
/*++
Routine Description:
TODO: Add function description /**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
Arguments: This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
This - TODO: add argument description @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
Language - TODO: add argument description EFI_COMPONENT_NAME_PROTOCOL instance.
DriverName - TODO: add argument description
Returns: @param ControllerHandle[in] The handle of a controller that the driver
specified by This is managing. This handle
specifies the controller whose name is to be
returned.
TODO: add return values @param ChildHandle[in] 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[in] A pointer to a Null-terminated ASCII string
; array indicating the language. This is the
language of the driver name 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. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] 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 EFI_STATUS
EFIAPI EFIAPI
PciBusComponentNameGetControllerName ( PciBusComponentNameGetControllerName (
@@ -54,26 +145,7 @@ PciBusComponentNameGetControllerName (
IN EFI_HANDLE ChildHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language, IN CHAR8 *Language,
OUT CHAR16 **ControllerName 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 #endif

View File

@@ -76,14 +76,13 @@ Returns:
// //
// Install driver model protocol(s). // Install driver model protocol(s).
// //
Status = EfiLibInstallAllDriverProtocols ( Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gPciBusDriverBinding, &gPciBusDriverBinding,
ImageHandle, ImageHandle,
&gPciBusComponentName, &gPciBusComponentName,
NULL, &gPciBusComponentName2
NULL
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);

View File

@@ -239,6 +239,7 @@ typedef struct _PCI_IO_DEVICE {
// //
extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPciBusComponentName2;
extern LIST_ENTRY gPciDevicePool; extern LIST_ENTRY gPciDevicePool;
extern BOOLEAN gFullEnumeration; extern BOOLEAN gFullEnumeration;
extern UINTN gPciHostBridgeNumber; extern UINTN gPciHostBridgeNumber;

View File

@@ -1,155 +1,311 @@
/** @file /** @file
Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "VgaMiniPort.h" #include "VgaMiniPort.h"
// //
// EFI Component Name Functions // EFI Component Name Functions
// //
EFI_STATUS /**
EFIAPI Retrieves a Unicode string that is the user readable name of the driver.
PciVgaMiniPortComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This, This function retrieves the user readable name of a driver in the form of a
IN CHAR8 *Language, Unicode string. If the driver specified by This has a user readable name in
OUT CHAR16 **DriverName the language specified by Language, then a pointer to the driver name is
); returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
EFI_STATUS then EFI_UNSUPPORTED is returned.
EFIAPI
PciVgaMiniPortComponentNameGetControllerName ( @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
IN EFI_COMPONENT_NAME_PROTOCOL *This, EFI_COMPONENT_NAME_PROTOCOL instance.
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL, @param Language[in] A pointer to a Null-terminated ASCII string
IN CHAR8 *Language, array indicating the language. This is the
OUT CHAR16 **ControllerName language of the driver name 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
// EFI Component Name Protocol to the driver writer. Language is specified
// in RFC 3066 or ISO 639-2 language code format.
EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName = {
PciVgaMiniPortComponentNameGetDriverName, @param DriverName[out] A pointer to the Unicode string to return.
PciVgaMiniPortComponentNameGetControllerName, This Unicode string is the name of the
"eng" driver specified by This in the language
}; specified by Language.
static EFI_UNICODE_STRING_TABLE mPciVgaMiniPortDriverNameTable[] = { @retval EFI_SUCCESS The Unicode string for the Driver specified by
{ This and the language specified by Language was
"eng", returned in DriverName.
L"PCI VGA Mini Port Driver"
}, @retval EFI_INVALID_PARAMETER Language is NULL.
{
NULL, @retval EFI_INVALID_PARAMETER DriverName is NULL.
NULL
} @retval EFI_UNSUPPORTED The driver specified by This does not support
}; the language specified by Language.
EFI_STATUS **/
EFIAPI EFI_STATUS
PciVgaMiniPortComponentNameGetDriverName ( EFIAPI
IN EFI_COMPONENT_NAME_PROTOCOL *This, PciVgaMiniPortComponentNameGetDriverName (
IN CHAR8 *Language, IN EFI_COMPONENT_NAME_PROTOCOL *This,
OUT CHAR16 **DriverName IN CHAR8 *Language,
) OUT CHAR16 **DriverName
/*++ );
Routine Description:
Retrieves a Unicode string that is the user readable name of the EFI Driver. /**
Retrieves a Unicode string that is the user readable name of the controller
Arguments: that is being managed by a driver.
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
Language - A pointer to a three character ISO 639-2 language identifier. This function retrieves the user readable name of the controller specified by
This is the language of the driver name that that the caller ControllerHandle and ChildHandle in the form of a Unicode string. If the
is requesting, and it must match one of the languages specified driver specified by This has a user readable name in the language specified by
in SupportedLanguages. The number of languages supported by a Language, then a pointer to the controller name is returned in ControllerName,
driver is up to the driver writer. and EFI_SUCCESS is returned. If the driver specified by This is not currently
DriverName - A pointer to the Unicode string to return. This Unicode string managing the controller specified by ControllerHandle and ChildHandle,
is the name of the driver specified by This in the language then EFI_UNSUPPORTED is returned. If the driver specified by This does not
specified by Language. support the language specified by Language, then EFI_UNSUPPORTED is returned.
Returns: @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_SUCCESS - The Unicode string for the Driver specified by This EFI_COMPONENT_NAME_PROTOCOL instance.
and the language specified by Language was returned
in DriverName. @param ControllerHandle[in] The handle of a controller that the driver
EFI_INVALID_PARAMETER - Language is NULL. specified by This is managing. This handle
EFI_INVALID_PARAMETER - DriverName is NULL. specifies the controller whose name is to be
EFI_UNSUPPORTED - The driver specified by This does not support the returned.
language specified by Language.
@param ChildHandle[in] 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
return LookupUnicodeString ( drivers. It will also be NULL for a bus drivers
Language, that wish to retrieve the name of the bus
gPciVgaMiniPortComponentName.SupportedLanguages, controller. It will not be NULL for a bus
mPciVgaMiniPortDriverNameTable, driver that wishes to retrieve the name of a
DriverName child controller.
);
} @param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
EFI_STATUS language of the driver name that the caller is
EFIAPI requesting, and it must match one of the
PciVgaMiniPortComponentNameGetControllerName ( languages specified in SupportedLanguages. The
IN EFI_COMPONENT_NAME_PROTOCOL *This, number of languages supported by a driver is up
IN EFI_HANDLE ControllerHandle, to the driver writer. Language is specified in
IN EFI_HANDLE ChildHandle OPTIONAL, RFC 3066 or ISO 639-2 language code format.
IN CHAR8 *Language,
OUT CHAR16 **ControllerName @param ControllerName[out] 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
Routine Description: Language from the point of view of the driver
Retrieves a Unicode string that is the user readable name of the controller specified by This.
that is being managed by an EFI Driver.
@retval EFI_SUCCESS The Unicode string for the user readable name in
Arguments: the language specified by Language for the
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance. driver specified by This was returned in
ControllerHandle - The handle of a controller that the driver specified by DriverName.
This is managing. This handle specifies the controller
whose name is to be returned. @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
ChildHandle - The handle of the child controller to retrieve the name
of. This is an optional parameter that may be NULL. It @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
will be NULL for device drivers. It will also be NULL EFI_HANDLE.
for a bus drivers that wish to retrieve the name of the
bus controller. It will not be NULL for a bus driver @retval EFI_INVALID_PARAMETER Language is NULL.
that wishes to retrieve the name of a child controller.
Language - A pointer to a three character ISO 639-2 language @retval EFI_INVALID_PARAMETER ControllerName is NULL.
identifier. This is the language of the controller name
that that the caller is requesting, and it must match one @retval EFI_UNSUPPORTED The driver specified by This is not currently
of the languages specified in SupportedLanguages. The managing the controller specified by
number of languages supported by a driver is up to the ControllerHandle and ChildHandle.
driver writer.
ControllerName - A pointer to the Unicode string to return. This Unicode @retval EFI_UNSUPPORTED The driver specified by This does not support
string is the name of the controller specified by the language specified by Language.
ControllerHandle and ChildHandle in the language
specified by Language from the point of view of the **/
driver specified by This. EFI_STATUS
EFIAPI
Returns: PciVgaMiniPortComponentNameGetControllerName (
EFI_SUCCESS - The Unicode string for the user readable name in the IN EFI_COMPONENT_NAME_PROTOCOL *This,
language specified by Language for the driver IN EFI_HANDLE ControllerHandle,
specified by This was returned in DriverName. IN EFI_HANDLE ChildHandle OPTIONAL,
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE. IN CHAR8 *Language,
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid OUT CHAR16 **ControllerName
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 // EFI Component Name Protocol
ControllerHandle and ChildHandle. //
EFI_UNSUPPORTED - The driver specified by This does not support the EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName = {
language specified by Language. PciVgaMiniPortComponentNameGetDriverName,
PciVgaMiniPortComponentNameGetControllerName,
--*/ "eng"
{ };
return EFI_UNSUPPORTED;
} //
// EFI Component Name 2 Protocol
//
EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PciVgaMiniPortComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PciVgaMiniPortComponentNameGetControllerName,
"en"
};
static EFI_UNICODE_STRING_TABLE mPciVgaMiniPortDriverNameTable[] = {
{
"eng;en",
L"PCI VGA Mini Port Driver"
},
{
NULL,
NULL
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
This function retrieves the user readable name of a driver in the form of a
Unicode string. If the driver specified by This has a user readable name in
the language specified by Language, then a pointer to the driver name is
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
by This does not support the language specified by Language,
then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param Language[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified
in RFC 3066 or ISO 639-2 language code format.
@param DriverName[out] 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
PciVgaMiniPortComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mPciVgaMiniPortDriverNameTable,
DriverName,
(BOOLEAN)(This == &gPciVgaMiniPortComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
This function retrieves the user readable name of the controller specified by
ControllerHandle and ChildHandle in the form of a Unicode string. If the
driver specified by This has a user readable name in the language specified by
Language, then a pointer to the controller name is returned in ControllerName,
and EFI_SUCCESS is returned. If the driver specified by This is not currently
managing the controller specified by ControllerHandle and ChildHandle,
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
support the language specified by Language, then EFI_UNSUPPORTED is returned.
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
EFI_COMPONENT_NAME_PROTOCOL instance.
@param ControllerHandle[in] 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[in] 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[in] A pointer to a Null-terminated ASCII string
array indicating the language. This is the
language of the driver name 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. Language is specified in
RFC 3066 or ISO 639-2 language code format.
@param ControllerName[out] 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
PciVgaMiniPortComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
}

View File

@@ -1,312 +1,311 @@
/** @file /** @file
Copyright (c) 2006 Intel Corporation. All rights reserved Copyright (c) 2006 Intel Corporation. All rights reserved
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#include "VgaMiniPort.h" #include "VgaMiniPort.h"
// //
// EFI Driver Binding Protocol Instance // EFI Driver Binding Protocol Instance
// //
// This driver has a version value of 0x00000000. This is the // This driver has a version value of 0x00000000. This is the
// lowest possible priority for a driver. This is done on purpose to help // lowest possible priority for a driver. This is done on purpose to help
// the developers of UGA drivers. This driver can bind if no UGA driver // the developers of UGA drivers. This driver can bind if no UGA driver
// is present, so a console is available. Then, when a UGA driver is loaded // is present, so a console is available. Then, when a UGA driver is loaded
// this driver can be disconnected, and the UGA driver can be connected. // this driver can be disconnected, and the UGA driver can be connected.
// As long as the UGA driver has a version value greater than 0x00000000, it // As long as the UGA driver has a version value greater than 0x00000000, it
// will be connected first and will block this driver from connecting. // will be connected first and will block this driver from connecting.
// //
EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding = { EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding = {
PciVgaMiniPortDriverBindingSupported, PciVgaMiniPortDriverBindingSupported,
PciVgaMiniPortDriverBindingStart, PciVgaMiniPortDriverBindingStart,
PciVgaMiniPortDriverBindingStop, PciVgaMiniPortDriverBindingStop,
0x00000000, 0x00000000,
NULL, NULL,
NULL NULL
}; };
// //
// Driver Entry Point // Driver Entry Point
// //
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
PciVgaMiniPortDriverEntryPoint ( PciVgaMiniPortDriverEntryPoint (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
/*++ /*++
Routine Description: Routine Description:
Driver Entry Point. Driver Entry Point.
Arguments: Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns: Returns:
EFI_STATUS EFI_STATUS
--*/ --*/
{ {
return EfiLibInstallAllDriverProtocols ( return EfiLibInstallDriverBindingComponentName2 (
ImageHandle, ImageHandle,
SystemTable, SystemTable,
&gPciVgaMiniPortDriverBinding, &gPciVgaMiniPortDriverBinding,
ImageHandle, ImageHandle,
&gPciVgaMiniPortComponentName, &gPciVgaMiniPortComponentName,
NULL, &gPciVgaMiniPortComponentName2
NULL );
); }
}
/**
/** Supported.
Supported.
(Standard DriverBinding Protocol Supported() function)
(Standard DriverBinding Protocol Supported() function)
@return EFI_STATUS
@return EFI_STATUS
**/
**/ EFI_STATUS
EFI_STATUS EFIAPI
EFIAPI PciVgaMiniPortDriverBindingSupported (
PciVgaMiniPortDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller,
IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath )
) {
{ EFI_STATUS Status;
EFI_STATUS Status; EFI_PCI_IO_PROTOCOL *PciIo;
EFI_PCI_IO_PROTOCOL *PciIo; PCI_TYPE00 Pci;
PCI_TYPE00 Pci;
//
// // Open the IO Abstraction(s) needed to perform the supported test
// Open the IO Abstraction(s) needed to perform the supported test //
// Status = gBS->OpenProtocol (
Status = gBS->OpenProtocol ( Controller,
Controller, &gEfiPciIoProtocolGuid,
&gEfiPciIoProtocolGuid, (VOID **) &PciIo,
(VOID **) &PciIo, This->DriverBindingHandle,
This->DriverBindingHandle, Controller,
Controller, EFI_OPEN_PROTOCOL_BY_DRIVER
EFI_OPEN_PROTOCOL_BY_DRIVER );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { return Status;
return Status; }
} //
// // See if this is a PCI VGA Controller by looking at the Command register and
// See if this is a PCI VGA Controller by looking at the Command register and // Class Code Register
// Class Code Register //
// Status = PciIo->Pci.Read (
Status = PciIo->Pci.Read ( PciIo,
PciIo, EfiPciIoWidthUint32,
EfiPciIoWidthUint32, 0,
0, sizeof (Pci) / sizeof (UINT32),
sizeof (Pci) / sizeof (UINT32), &Pci
&Pci );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { goto Done;
goto Done; }
}
Status = EFI_UNSUPPORTED;
Status = EFI_UNSUPPORTED; //
// // See if the device is an enabled VGA device.
// See if the device is an enabled VGA device. // Most systems can only have on VGA device on at a time.
// Most systems can only have on VGA device on at a time. //
// if (((Pci.Hdr.Command & 0x03) == 0x03) && IS_PCI_VGA (&Pci)) {
if (((Pci.Hdr.Command & 0x03) == 0x03) && IS_PCI_VGA (&Pci)) { Status = EFI_SUCCESS;
Status = EFI_SUCCESS; }
}
Done:
Done: gBS->CloseProtocol (
gBS->CloseProtocol ( Controller,
Controller, &gEfiPciIoProtocolGuid,
&gEfiPciIoProtocolGuid, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
);
return Status;
return Status; }
}
/**
/** Install VGA Mini Port Protocol onto VGA device handles
Install VGA Mini Port Protocol onto VGA device handles
(Standard DriverBinding Protocol Start() function)
(Standard DriverBinding Protocol Start() function)
@return EFI_STATUS
@return EFI_STATUS
**/
**/ EFI_STATUS
EFI_STATUS EFIAPI
EFIAPI PciVgaMiniPortDriverBindingStart (
PciVgaMiniPortDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller,
IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath )
) {
{ EFI_STATUS Status;
EFI_STATUS Status; EFI_PCI_IO_PROTOCOL *PciIo;
EFI_PCI_IO_PROTOCOL *PciIo; PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;
PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;
PciVgaMiniPortPrivate = NULL;
PciVgaMiniPortPrivate = NULL; PciIo = NULL;
PciIo = NULL; //
// // Open the IO Abstraction(s) needed
// Open the IO Abstraction(s) needed //
// Status = gBS->OpenProtocol (
Status = gBS->OpenProtocol ( Controller,
Controller, &gEfiPciIoProtocolGuid,
&gEfiPciIoProtocolGuid, (VOID **) &PciIo,
(VOID **) &PciIo, This->DriverBindingHandle,
This->DriverBindingHandle, Controller,
Controller, EFI_OPEN_PROTOCOL_BY_DRIVER
EFI_OPEN_PROTOCOL_BY_DRIVER );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { goto Done;
goto Done; }
} //
// // Allocate the private device structure
// Allocate the private device structure //
// Status = gBS->AllocatePool (
Status = gBS->AllocatePool ( EfiBootServicesData,
EfiBootServicesData, sizeof (PCI_VGA_MINI_PORT_DEV),
sizeof (PCI_VGA_MINI_PORT_DEV), (VOID **) &PciVgaMiniPortPrivate
(VOID **) &PciVgaMiniPortPrivate );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { goto Done;
goto Done; }
}
ZeroMem (PciVgaMiniPortPrivate, sizeof (PCI_VGA_MINI_PORT_DEV));
ZeroMem (PciVgaMiniPortPrivate, sizeof (PCI_VGA_MINI_PORT_DEV));
//
// // Initialize the private device structure
// Initialize the private device structure //
// PciVgaMiniPortPrivate->Signature = PCI_VGA_MINI_PORT_DEV_SIGNATURE;
PciVgaMiniPortPrivate->Signature = PCI_VGA_MINI_PORT_DEV_SIGNATURE; PciVgaMiniPortPrivate->Handle = Controller;
PciVgaMiniPortPrivate->Handle = Controller; PciVgaMiniPortPrivate->PciIo = PciIo;
PciVgaMiniPortPrivate->PciIo = PciIo;
PciVgaMiniPortPrivate->VgaMiniPort.SetMode = PciVgaMiniPortSetMode;
PciVgaMiniPortPrivate->VgaMiniPort.SetMode = PciVgaMiniPortSetMode; PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryOffset = 0xb8000;
PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryOffset = 0xb8000; PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterOffset = 0x3d4;
PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterOffset = 0x3d4; PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterOffset = 0x3d5;
PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterOffset = 0x3d5; PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryBar = EFI_PCI_IO_PASS_THROUGH_BAR;
PciVgaMiniPortPrivate->VgaMiniPort.VgaMemoryBar = EFI_PCI_IO_PASS_THROUGH_BAR; PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;
PciVgaMiniPortPrivate->VgaMiniPort.CrtcAddressRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR; PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR;
PciVgaMiniPortPrivate->VgaMiniPort.CrtcDataRegisterBar = EFI_PCI_IO_PASS_THROUGH_BAR; PciVgaMiniPortPrivate->VgaMiniPort.MaxMode = 1;
PciVgaMiniPortPrivate->VgaMiniPort.MaxMode = 1;
//
// // Install Vga Mini Port Protocol
// Install Vga Mini Port Protocol //
// Status = gBS->InstallMultipleProtocolInterfaces (
Status = gBS->InstallMultipleProtocolInterfaces ( &Controller,
&Controller, &gEfiVgaMiniPortProtocolGuid,
&gEfiVgaMiniPortProtocolGuid, &PciVgaMiniPortPrivate->VgaMiniPort,
&PciVgaMiniPortPrivate->VgaMiniPort, NULL
NULL );
); Done:
Done: if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { gBS->CloseProtocol (
gBS->CloseProtocol ( Controller,
Controller, &gEfiPciIoProtocolGuid,
&gEfiPciIoProtocolGuid, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
); if (PciVgaMiniPortPrivate) {
if (PciVgaMiniPortPrivate) { gBS->FreePool (PciVgaMiniPortPrivate);
gBS->FreePool (PciVgaMiniPortPrivate); }
} }
}
return Status;
return Status; }
}
/**
/** Stop.
Stop.
(Standard DriverBinding Protocol Stop() function)
(Standard DriverBinding Protocol Stop() function)
@return EFI_STATUS
@return EFI_STATUS
**/
**/ EFI_STATUS
EFI_STATUS EFIAPI
EFIAPI PciVgaMiniPortDriverBindingStop (
PciVgaMiniPortDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller,
IN EFI_HANDLE Controller, IN UINTN NumberOfChildren,
IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer
IN EFI_HANDLE *ChildHandleBuffer )
) {
{ EFI_STATUS Status;
EFI_STATUS Status; EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;
EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort; PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;
PCI_VGA_MINI_PORT_DEV *PciVgaMiniPortPrivate;
Status = gBS->OpenProtocol (
Status = gBS->OpenProtocol ( Controller,
Controller, &gEfiVgaMiniPortProtocolGuid,
&gEfiVgaMiniPortProtocolGuid, (VOID **) &VgaMiniPort,
(VOID **) &VgaMiniPort, This->DriverBindingHandle,
This->DriverBindingHandle, Controller,
Controller, EFI_OPEN_PROTOCOL_GET_PROTOCOL
EFI_OPEN_PROTOCOL_GET_PROTOCOL );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { return Status;
return Status; }
}
PciVgaMiniPortPrivate = PCI_VGA_MINI_PORT_DEV_FROM_THIS (VgaMiniPort);
PciVgaMiniPortPrivate = PCI_VGA_MINI_PORT_DEV_FROM_THIS (VgaMiniPort);
Status = gBS->UninstallProtocolInterface (
Status = gBS->UninstallProtocolInterface ( Controller,
Controller, &gEfiVgaMiniPortProtocolGuid,
&gEfiVgaMiniPortProtocolGuid, &PciVgaMiniPortPrivate->VgaMiniPort
&PciVgaMiniPortPrivate->VgaMiniPort );
); if (EFI_ERROR (Status)) {
if (EFI_ERROR (Status)) { return Status;
return Status; }
}
gBS->CloseProtocol (
gBS->CloseProtocol ( Controller,
Controller, &gEfiPciIoProtocolGuid,
&gEfiPciIoProtocolGuid, This->DriverBindingHandle,
This->DriverBindingHandle, Controller
Controller );
);
gBS->FreePool (PciVgaMiniPortPrivate);
gBS->FreePool (PciVgaMiniPortPrivate);
return EFI_SUCCESS;
return EFI_SUCCESS; }
} //
// // VGA Mini Port Protocol Functions
// VGA Mini Port Protocol Functions //
//
/**
/** GC_TODO: Add function description
GC_TODO: Add function description
@param This GC_TODO: add argument description
@param This GC_TODO: add argument description @param ModeNumber GC_TODO: add argument description
@param ModeNumber GC_TODO: add argument description
@retval EFI_UNSUPPORTED GC_TODO: Add description for return value
@retval EFI_UNSUPPORTED GC_TODO: Add description for return value @retval EFI_SUCCESS GC_TODO: Add description for return value
@retval EFI_SUCCESS GC_TODO: Add description for return value
**/
**/ EFI_STATUS
EFI_STATUS EFIAPI
EFIAPI PciVgaMiniPortSetMode (
PciVgaMiniPortSetMode ( IN EFI_VGA_MINI_PORT_PROTOCOL *This,
IN EFI_VGA_MINI_PORT_PROTOCOL *This, IN UINTN ModeNumber
IN UINTN ModeNumber )
) {
{ if (ModeNumber > This->MaxMode) {
if (ModeNumber > This->MaxMode) { return EFI_UNSUPPORTED;
return EFI_UNSUPPORTED; }
}
return EFI_SUCCESS;
return EFI_SUCCESS; }
}

View File

@@ -1,95 +1,96 @@
/** @file /** @file
Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved Copyright (c) 2006 - 2007 Intel Corporation. All rights reserved
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
#ifndef _VGA_MINIPORT_H #ifndef _VGA_MINIPORT_H
#define _VGA_MINIPORT_H #define _VGA_MINIPORT_H
// //
// The package level header files this module uses // The package level header files this module uses
// //
#include <PiDxe.h> #include <PiDxe.h>
// //
// The protocols, PPI and GUID defintions for this module // The protocols, PPI and GUID defintions for this module
// //
#include <Protocol/PciIo.h> #include <Protocol/PciIo.h>
#include <Protocol/VgaMiniPort.h> #include <Protocol/VgaMiniPort.h>
#include <Protocol/ComponentName2.h> #include <Protocol/ComponentName2.h>
// //
// The Library classes this module consumes // The Library classes this module consumes
// //
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/UefiDriverEntryPoint.h> #include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <IndustryStandard/Pci22.h> #include <IndustryStandard/Pci22.h>
// //
// PCI VGA MiniPort Device Structure // PCI VGA MiniPort Device Structure
// //
#define PCI_VGA_MINI_PORT_DEV_SIGNATURE EFI_SIGNATURE_32('P','V','M','P') #define PCI_VGA_MINI_PORT_DEV_SIGNATURE EFI_SIGNATURE_32('P','V','M','P')
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_HANDLE Handle; EFI_HANDLE Handle;
EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort; EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;
EFI_PCI_IO_PROTOCOL *PciIo; EFI_PCI_IO_PROTOCOL *PciIo;
} PCI_VGA_MINI_PORT_DEV; } PCI_VGA_MINI_PORT_DEV;
#define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE) #define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE)
// //
// Global Variables // Global Variables
// //
extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding; extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName; extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2;
//
// Driver Binding Protocol functions //
// // Driver Binding Protocol functions
EFI_STATUS //
PciVgaMiniPortDriverBindingSupported ( EFI_STATUS
IN EFI_DRIVER_BINDING_PROTOCOL *This, PciVgaMiniPortDriverBindingSupported (
IN EFI_HANDLE Controller, IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath IN EFI_HANDLE Controller,
); IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
PciVgaMiniPortDriverBindingStart ( EFI_STATUS
IN EFI_DRIVER_BINDING_PROTOCOL *This, PciVgaMiniPortDriverBindingStart (
IN EFI_HANDLE Controller, IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath IN EFI_HANDLE Controller,
); IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
EFI_STATUS
PciVgaMiniPortDriverBindingStop ( EFI_STATUS
IN EFI_DRIVER_BINDING_PROTOCOL *This, PciVgaMiniPortDriverBindingStop (
IN EFI_HANDLE Controller, IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN UINTN NumberOfChildren, IN EFI_HANDLE Controller,
IN EFI_HANDLE *ChildHandleBuffer IN UINTN NumberOfChildren,
); IN EFI_HANDLE *ChildHandleBuffer
);
//
// VGA Mini Port Protocol functions //
// // VGA Mini Port Protocol functions
EFI_STATUS //
EFIAPI EFI_STATUS
PciVgaMiniPortSetMode ( EFIAPI
IN EFI_VGA_MINI_PORT_PROTOCOL *This, PciVgaMiniPortSetMode (
IN UINTN ModeNumber IN EFI_VGA_MINI_PORT_PROTOCOL *This,
); IN UINTN ModeNumber
);
#endif
#endif