summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2016-06-12 14:45:53 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-06-14 09:45:39 +0800
commit26a7ece72189cb83b1be4bf529253ca1e7b9cb57 (patch)
tree565664fa6723bdb761a01d55ca2255f0d1327afc
parentd6f38e374ece00f1f8176007c9d3e8eff1f2308f (diff)
downloadedk2-26a7ece72189cb83b1be4bf529253ca1e7b9cb57.zip
edk2-26a7ece72189cb83b1be4bf529253ca1e7b9cb57.tar.gz
edk2-26a7ece72189cb83b1be4bf529253ca1e7b9cb57.tar.bz2
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>
-rw-r--r--IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c90
1 files changed, 57 insertions, 33 deletions
diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c
index f82121c..6c7d7d6 100644
--- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c
+++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c
@@ -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,35 +49,9 @@ 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
//
Status = gBS->LocateHandleBuffer (
@@ -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;
}