IntelFrameworkModulePkg/LegacyBios: Get SIO data in separate function

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
Ruiyu Ni 2016-06-12 14:45:53 +08:00
parent d6f38e374e
commit 26a7ece721
1 changed files with 57 additions and 33 deletions

View File

@ -2,7 +2,7 @@
Collect Sio information from Native EFI Drivers.
Sio is floppy, parallel, serial, ... hardware
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@ -19,24 +19,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
/**
Collect EFI Info about legacy devices.
Collect EFI Info about legacy devices through ISA IO interface.
@param Private Legacy BIOS Instance data
@param SioPtr Pointer to SIO data.
@retval EFI_SUCCESS It should always work.
**/
EFI_STATUS
LegacyBiosBuildSioData (
IN LEGACY_BIOS_INSTANCE *Private
LegacyBiosBuildSioDataFromIsaIo (
IN DEVICE_PRODUCER_DATA_HEADER *SioPtr
)
{
EFI_STATUS Status;
DEVICE_PRODUCER_DATA_HEADER *SioPtr;
DEVICE_PRODUCER_SERIAL *Sio1Ptr;
DEVICE_PRODUCER_PARALLEL *Sio2Ptr;
DEVICE_PRODUCER_FLOPPY *Sio3Ptr;
EFI_HANDLE IsaBusController;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
@ -51,34 +49,8 @@ LegacyBiosBuildSioData (
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
//
// Get the pointer to the SIO data structure
//
SioPtr = &Private->IntThunk->EfiToLegacy16BootTable.SioData;
//
// Zero the data in the SIO data structure
//
gBS->SetMem (SioPtr, sizeof (DEVICE_PRODUCER_DATA_HEADER), 0);
//
// Find the ISA Bus Controller used for legacy
//
Status = Private->LegacyBiosPlatform->GetPlatformHandle (
Private->LegacyBiosPlatform,
EfiGetPlatformIsaBusHandle,
0,
&HandleBuffer,
&HandleCount,
NULL
);
IsaBusController = HandleBuffer[0];
if (!EFI_ERROR (Status)) {
//
// Force ISA Bus Controller to produce all ISA devices
//
gBS->ConnectController (IsaBusController, NULL, NULL, TRUE);
}
//
// Get the list of ISA controllers in the system
//
@ -229,6 +201,58 @@ LegacyBiosBuildSioData (
}
FreePool (HandleBuffer);
return EFI_SUCCESS;
}
/**
Collect EFI Info about legacy devices.
@param Private Legacy BIOS Instance data
@retval EFI_SUCCESS It should always work.
**/
EFI_STATUS
LegacyBiosBuildSioData (
IN LEGACY_BIOS_INSTANCE *Private
)
{
EFI_STATUS Status;
DEVICE_PRODUCER_DATA_HEADER *SioPtr;
EFI_HANDLE IsaBusController;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
//
// Get the pointer to the SIO data structure
//
SioPtr = &Private->IntThunk->EfiToLegacy16BootTable.SioData;
//
// Zero the data in the SIO data structure
//
gBS->SetMem (SioPtr, sizeof (DEVICE_PRODUCER_DATA_HEADER), 0);
//
// Find the ISA Bus Controller used for legacy
//
Status = Private->LegacyBiosPlatform->GetPlatformHandle (
Private->LegacyBiosPlatform,
EfiGetPlatformIsaBusHandle,
0,
&HandleBuffer,
&HandleCount,
NULL
);
IsaBusController = HandleBuffer[0];
if (!EFI_ERROR (Status)) {
//
// Force ISA Bus Controller to produce all ISA devices
//
gBS->ConnectController (IsaBusController, NULL, NULL, TRUE);
}
LegacyBiosBuildSioDataFromIsaIo (SioPtr);
return EFI_SUCCESS;
}