]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Isa / IsaBusDxe / IsaBusDxe.c
index 7067c6e6f0aff943881ed848edea985483f25320..38ea13a203854c8cda7354c2499dcf2c1d422cfa 100644 (file)
@@ -3,14 +3,8 @@
   Controller and installs the ISA Host Controller Service Binding protocol\r
   on the ISA Host Controller's handle.\r
 \r
-  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 \r
 **/\r
 #include "ComponentName.h"\r
 \r
 /**\r
-  Tests to see if this driver supports a given controller. If a child device is provided, \r
+  Tests to see if this driver supports a given controller. If a child device is provided,\r
   it further tests to see if this driver supports creating a handle for the specified child device.\r
 \r
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle     The handle of the controller to test. This handle \r
-                                   must support a protocol interface that supplies \r
+  @param[in]  ControllerHandle     The handle of the controller to test. This handle\r
+                                   must support a protocol interface that supplies\r
                                    an I/O abstraction to the driver.\r
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This \r
-                                   parameter is ignored by device drivers, and is optional for bus \r
-                                   drivers. For bus drivers, if this parameter is not NULL, then \r
-                                   the bus driver must determine if the bus controller specified \r
-                                   by ControllerHandle and the child controller specified \r
-                                   by RemainingDevicePath are both supported by this \r
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This\r
+                                   parameter is ignored by device drivers, and is optional for bus\r
+                                   drivers. For bus drivers, if this parameter is not NULL, then\r
+                                   the bus driver must determine if the bus controller specified\r
+                                   by ControllerHandle and the child controller specified\r
+                                   by RemainingDevicePath are both supported by this\r
                                    bus driver.\r
 \r
   @retval EFI_SUCCESS              The device specified by ControllerHandle and\r
 EFI_STATUS\r
 EFIAPI\r
 IsaBusDriverBindingSupported (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
 {\r
-  EFI_STATUS                        Status;\r
-  VOID                              *Instance;\r
+  EFI_STATUS  Status;\r
+  VOID        *Instance;\r
 \r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
@@ -67,11 +61,11 @@ IsaBusDriverBindingSupported (
                   );\r
   if (!EFI_ERROR (Status)) {\r
     gBS->CloseProtocol (\r
-      Controller,\r
-      &gEfiIsaHcProtocolGuid,\r
-      This->DriverBindingHandle,\r
-      Controller\r
-      );\r
+           Controller,\r
+           &gEfiIsaHcProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
@@ -88,36 +82,36 @@ IsaBusDriverBindingSupported (
                   );\r
   if (!EFI_ERROR (Status)) {\r
     gBS->CloseProtocol (\r
-      Controller,\r
-      &gEfiDevicePathProtocolGuid,\r
-      This->DriverBindingHandle,\r
-      Controller\r
-      );\r
+           Controller,\r
+           &gEfiDevicePathProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
   }\r
 \r
   return Status;\r
 }\r
 \r
-ISA_BUS_CHILD_PRIVATE_DATA mIsaBusChildPrivateTemplate = {\r
+ISA_BUS_CHILD_PRIVATE_DATA  mIsaBusChildPrivateTemplate = {\r
   ISA_BUS_CHILD_PRIVATE_DATA_SIGNATURE,\r
   FALSE\r
 };\r
 \r
 /**\r
   Creates a child handle and installs a protocol.\r
-  \r
-  The CreateChild() function installs a protocol on ChildHandle. \r
-  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. \r
+\r
+  The CreateChild() function installs a protocol on ChildHandle.\r
+  If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.\r
   If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   @param  ChildHandle Pointer to the handle of the child to create. If it is NULL,\r
-                      then a new handle is created. If it is a pointer to an existing UEFI handle, \r
+                      then a new handle is created. If it is a pointer to an existing UEFI handle,\r
                       then the protocol is added to the existing UEFI handle.\r
 \r
-  @retval EFI_SUCCES            The protocol was added to ChildHandle.\r
+  @retval EFI_SUCCESS           The protocol was added to ChildHandle.\r
   @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
-  @retval EFI_OUT_OF_RESOURCES  There are not enough resources availabe to create\r
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to create\r
                                 the child\r
   @retval other                 The child handle was not created\r
 \r
@@ -129,10 +123,10 @@ IsaBusCreateChild (
   IN OUT EFI_HANDLE                    *ChildHandle\r
   )\r
 {\r
-  EFI_STATUS                           Status;\r
-  ISA_BUS_PRIVATE_DATA                 *Private;\r
-  EFI_ISA_HC_PROTOCOL                  *IsaHc;\r
-  ISA_BUS_CHILD_PRIVATE_DATA           *Child;\r
+  EFI_STATUS                  Status;\r
+  ISA_BUS_PRIVATE_DATA        *Private;\r
+  EFI_ISA_HC_PROTOCOL         *IsaHc;\r
+  ISA_BUS_CHILD_PRIVATE_DATA  *Child;\r
 \r
   Private = ISA_BUS_PRIVATE_DATA_FROM_THIS (This);\r
 \r
@@ -143,8 +137,10 @@ IsaBusCreateChild (
 \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   ChildHandle,\r
-                  &gEfiIsaHcProtocolGuid, Private->IsaHc,\r
-                  &gEfiCallerIdGuid,      Child,\r
+                  &gEfiIsaHcProtocolGuid,\r
+                  Private->IsaHc,\r
+                  &gEfiCallerIdGuid,\r
+                  Child,\r
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
@@ -155,7 +151,7 @@ IsaBusCreateChild (
   return gBS->OpenProtocol (\r
                 Private->IsaHcHandle,\r
                 &gEfiIsaHcProtocolGuid,\r
-                (VOID **) &IsaHc,\r
+                (VOID **)&IsaHc,\r
                 gIsaBusDriverBinding.DriverBindingHandle,\r
                 *ChildHandle,\r
                 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
@@ -164,15 +160,15 @@ IsaBusCreateChild (
 \r
 /**\r
   Destroys a child handle with a protocol installed on it.\r
-  \r
-  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol \r
-  that was installed by CreateChild() from ChildHandle. If the removed protocol is the \r
+\r
+  The DestroyChild() function does the opposite of CreateChild(). It removes a protocol\r
+  that was installed by CreateChild() from ChildHandle. If the removed protocol is the\r
   last protocol on ChildHandle, then ChildHandle is destroyed.\r
 \r
   @param  This        Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.\r
   @param  ChildHandle Handle of the child to destroy\r
 \r
-  @retval EFI_SUCCES            The protocol was removed from ChildHandle.\r
+  @retval EFI_SUCCESS           The protocol was removed from ChildHandle.\r
   @retval EFI_UNSUPPORTED       ChildHandle does not support the protocol that is being removed.\r
   @retval EFI_INVALID_PARAMETER Child handle is NULL.\r
   @retval EFI_ACCESS_DENIED     The protocol could not be removed from the ChildHandle\r
@@ -183,21 +179,21 @@ IsaBusCreateChild (
 EFI_STATUS\r
 EFIAPI\r
 IsaBusDestroyChild (\r
-  IN EFI_SERVICE_BINDING_PROTOCOL     *This,\r
-  IN EFI_HANDLE                       ChildHandle\r
+  IN EFI_SERVICE_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                    ChildHandle\r
   )\r
 {\r
-  EFI_STATUS                           Status;\r
-  ISA_BUS_PRIVATE_DATA                 *Private;\r
-  EFI_ISA_HC_PROTOCOL                  *IsaHc;\r
-  ISA_BUS_CHILD_PRIVATE_DATA           *Child;\r
+  EFI_STATUS                  Status;\r
+  ISA_BUS_PRIVATE_DATA        *Private;\r
+  EFI_ISA_HC_PROTOCOL         *IsaHc;\r
+  ISA_BUS_CHILD_PRIVATE_DATA  *Child;\r
 \r
   Private = ISA_BUS_PRIVATE_DATA_FROM_THIS (This);\r
 \r
   Status = gBS->OpenProtocol (\r
                   ChildHandle,\r
                   &gEfiCallerIdGuid,\r
-                  (VOID **) &Child,\r
+                  (VOID **)&Child,\r
                   gIsaBusDriverBinding.DriverBindingHandle,\r
                   ChildHandle,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -213,25 +209,27 @@ IsaBusDestroyChild (
   }\r
 \r
   Child->InDestroying = TRUE;\r
-  Status = gBS->CloseProtocol (\r
-                  Private->IsaHcHandle,\r
-                  &gEfiIsaHcProtocolGuid,\r
-                  gIsaBusDriverBinding.DriverBindingHandle,\r
-                  ChildHandle\r
-                  );\r
+  Status              = gBS->CloseProtocol (\r
+                               Private->IsaHcHandle,\r
+                               &gEfiIsaHcProtocolGuid,\r
+                               gIsaBusDriverBinding.DriverBindingHandle,\r
+                               ChildHandle\r
+                               );\r
   ASSERT_EFI_ERROR (Status);\r
   if (!EFI_ERROR (Status)) {\r
     Status = gBS->UninstallMultipleProtocolInterfaces (\r
                     ChildHandle,\r
-                    &gEfiIsaHcProtocolGuid, Private->IsaHc,\r
-                    &gEfiCallerIdGuid,      Child,\r
+                    &gEfiIsaHcProtocolGuid,\r
+                    Private->IsaHc,\r
+                    &gEfiCallerIdGuid,\r
+                    Child,\r
                     NULL\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       gBS->OpenProtocol (\r
              Private->IsaHcHandle,\r
              &gEfiIsaHcProtocolGuid,\r
-             (VOID **) &IsaHc,\r
+             (VOID **)&IsaHc,\r
              gIsaBusDriverBinding.DriverBindingHandle,\r
              ChildHandle,\r
              EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
@@ -248,7 +246,7 @@ IsaBusDestroyChild (
   return Status;\r
 }\r
 \r
-ISA_BUS_PRIVATE_DATA   mIsaBusPrivateTemplate = {\r
+ISA_BUS_PRIVATE_DATA  mIsaBusPrivateTemplate = {\r
   ISA_BUS_PRIVATE_DATA_SIGNATURE,\r
   {\r
     IsaBusCreateChild,\r
@@ -260,43 +258,43 @@ ISA_BUS_PRIVATE_DATA   mIsaBusPrivateTemplate = {
   Starts a device controller or a bus controller.\r
 \r
   @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle     The handle of the controller to start. This handle \r
-                                   must support a protocol interface that supplies \r
+  @param[in]  ControllerHandle     The handle of the controller to start. This handle\r
+                                   must support a protocol interface that supplies\r
                                    an I/O abstraction to the driver.\r
-  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This \r
-                                   parameter is ignored by device drivers, and is optional for bus \r
-                                   drivers. For a bus driver, if this parameter is NULL, then handles \r
-                                   for all the children of Controller are created by this driver.  \r
-                                   If this parameter is not NULL and the first Device Path Node is \r
-                                   not the End of Device Path Node, then only the handle for the \r
-                                   child device specified by the first Device Path Node of \r
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This\r
+                                   parameter is ignored by device drivers, and is optional for bus\r
+                                   drivers. For a bus driver, if this parameter is NULL, then handles\r
+                                   for all the children of Controller are created by this driver.\r
+                                   If this parameter is not NULL and the first Device Path Node is\r
+                                   not the End of Device Path Node, then only the handle for the\r
+                                   child device specified by the first Device Path Node of\r
                                    RemainingDevicePath is created by this driver.\r
-                                   If the first Device Path Node of RemainingDevicePath is \r
+                                   If the first Device Path Node of RemainingDevicePath is\r
                                    the End of Device Path Node, no child handle is created by this\r
                                    driver.\r
 \r
   @retval EFI_SUCCESS              The device was started.\r
   @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.\r
   @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.\r
-  @retval Others                   The driver failded to start the device.\r
+  @retval Others                   The driver failed to start the device.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaBusDriverBindingStart (\r
-  IN EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN EFI_HANDLE                     Controller,\r
-  IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   )\r
 {\r
-  EFI_STATUS                        Status;\r
-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
-  ISA_BUS_PRIVATE_DATA              *Private;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  ISA_BUS_PRIVATE_DATA      *Private;\r
 \r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiIsaHcProtocolGuid,\r
-                  (VOID **) &mIsaBusPrivateTemplate.IsaHc,\r
+                  (VOID **)&mIsaBusPrivateTemplate.IsaHc,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -308,7 +306,7 @@ IsaBusDriverBindingStart (
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &DevicePath,\r
+                  (VOID **)&DevicePath,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -330,7 +328,8 @@ IsaBusDriverBindingStart (
 \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &Controller,\r
-                  &gEfiIsaHcServiceBindingProtocolGuid, &Private->ServiceBinding,\r
+                  &gEfiIsaHcServiceBindingProtocolGuid,\r
+                  &Private->ServiceBinding,\r
                   NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
@@ -340,13 +339,13 @@ IsaBusDriverBindingStart (
 \r
 /**\r
   Stops a device controller or a bus controller.\r
-  \r
+\r
   @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
-  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must \r
-                                support a bus specific I/O protocol for the driver \r
+  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must\r
+                                support a bus specific I/O protocol for the driver\r
                                 to use to stop the device.\r
   @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.\r
-  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL \r
+  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL\r
                                 if NumberOfChildren is 0.\r
 \r
   @retval EFI_SUCCESS           The device was stopped.\r
@@ -356,22 +355,22 @@ IsaBusDriverBindingStart (
 EFI_STATUS\r
 EFIAPI\r
 IsaBusDriverBindingStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL    *This,\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  UINTN                          NumberOfChildren,\r
-  IN  EFI_HANDLE                     *ChildHandleBuffer\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN  EFI_HANDLE                   Controller,\r
+  IN  UINTN                        NumberOfChildren,\r
+  IN  EFI_HANDLE                   *ChildHandleBuffer\r
   )\r
 {\r
-  EFI_STATUS                         Status;\r
-  EFI_SERVICE_BINDING_PROTOCOL       *ServiceBinding;\r
-  ISA_BUS_PRIVATE_DATA               *Private;\r
-  UINTN                              Index;\r
-  BOOLEAN                            AllChildrenStopped;\r
+  EFI_STATUS                    Status;\r
+  EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;\r
+  ISA_BUS_PRIVATE_DATA          *Private;\r
+  UINTN                         Index;\r
+  BOOLEAN                       AllChildrenStopped;\r
 \r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
                   &gEfiIsaHcServiceBindingProtocolGuid,\r
-                  (VOID **) &ServiceBinding,\r
+                  (VOID **)&ServiceBinding,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -385,7 +384,8 @@ IsaBusDriverBindingStop (
   if (NumberOfChildren == 0) {\r
     Status = gBS->UninstallMultipleProtocolInterfaces (\r
                     Controller,\r
-                    &gEfiIsaHcServiceBindingProtocolGuid, &Private->ServiceBinding,\r
+                    &gEfiIsaHcServiceBindingProtocolGuid,\r
+                    &Private->ServiceBinding,\r
                     NULL\r
                     );\r
     if (!EFI_ERROR (Status)) {\r
@@ -421,7 +421,7 @@ IsaBusDriverBindingStop (
 //\r
 // ISA Bus Driver Binding Protocol Instance\r
 //\r
-EFI_DRIVER_BINDING_PROTOCOL gIsaBusDriverBinding = {\r
+EFI_DRIVER_BINDING_PROTOCOL  gIsaBusDriverBinding = {\r
   IsaBusDriverBindingSupported,\r
   IsaBusDriverBindingStart,\r
   IsaBusDriverBindingStop,\r
@@ -432,10 +432,10 @@ EFI_DRIVER_BINDING_PROTOCOL gIsaBusDriverBinding = {
 \r
 /**\r
   Entry point of the IsaBusDxe driver.\r
-  \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+\r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
   @param[in] SystemTable    A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS       The entry point is executed successfully.\r
   @retval other             Some error occurs when executing this entry point.\r
 **/\r
@@ -446,8 +446,8 @@ InitializeIsaBus (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS           Status;\r
-  \r
+  EFI_STATUS  Status;\r
+\r
   Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r