]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg/LegacyBios: Get SIO data in separate function
authorRuiyu Ni <ruiyu.ni@intel.com>
Sun, 12 Jun 2016 06:45:53 +0000 (14:45 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Tue, 14 Jun 2016 01:45:39 +0000 (09:45 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacySio.c

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