IntelFrameworkModulePkg: Modify IsaSerialDxe to follow driver rules

IsaSerialDxe creates child handles and wishes to retrieve the name for
those child controllers.

However, in the IsaSerialComponentNameGetControllerName() function, it
directly return EFI_UNSUPPORTED when ChildHandle != NULL.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17289 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hao Wu 2015-05-05 02:34:20 +00:00 committed by hwu1225
parent 724dcbb272
commit bc19591807
1 changed files with 37 additions and 27 deletions

View File

@ -183,13 +183,8 @@ IsaSerialComponentNameGetControllerName (
EFI_STATUS Status; EFI_STATUS Status;
EFI_SERIAL_IO_PROTOCOL *SerialIo; EFI_SERIAL_IO_PROTOCOL *SerialIo;
SERIAL_DEV *SerialDevice; SERIAL_DEV *SerialDevice;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
//
// This is a device driver, so ChildHandle must be NULL.
//
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
// //
// Make sure this driver is currently managing ControllerHandle // Make sure this driver is currently managing ControllerHandle
// //
@ -201,29 +196,44 @@ IsaSerialComponentNameGetControllerName (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
ControllerNameTable = NULL;
if (ChildHandle != NULL) {
Status = EfiTestChildHandle (
ControllerHandle,
ChildHandle,
&gEfiIsaIoProtocolGuid
);
if (EFI_ERROR (Status)) {
return Status;
}
// //
// Get the Block I/O Protocol on Controller // Get the Serial I/O Protocol from the child handle
// //
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
ControllerHandle, ChildHandle,
&gEfiSerialIoProtocolGuid, &gEfiSerialIoProtocolGuid,
(VOID **) &SerialIo, (VOID **) &SerialIo,
gSerialControllerDriver.DriverBindingHandle, gSerialControllerDriver.DriverBindingHandle,
ControllerHandle, ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
// //
// Get the Serial Controller's Device structure // Get the Serial Controller's Device structure
// //
SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo); SerialDevice = SERIAL_DEV_FROM_THIS (SerialIo);
ControllerNameTable = SerialDevice->ControllerNameTable;
}
return LookupUnicodeString2 ( return LookupUnicodeString2 (
Language, Language,
This->SupportedLanguages, This->SupportedLanguages,
SerialDevice->ControllerNameTable, ControllerNameTable,
ControllerName, ControllerName,
(BOOLEAN)(This == &gIsaSerialComponentName) (BOOLEAN)(This == &gIsaSerialComponentName)
); );