Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Eric Dong <[email protected]>
---
 .../Csm/LegacyBiosDxe/LegacySio.c                  | 90 ++++++++++++++--------
 1 file 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;
 }
-- 
2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to