]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c
ARM Packages: Fixed line endings
[mirror_edk2.git] / EmbeddedPkg / Library / EblNetworkLib / EblNetworkLib.c
index 0edd5d018dff071ef923d109f33b1dba377b8075..3b0f6a1c71e4281e419a3ac99327c0c79a1f0b56 100644 (file)
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD License
-  which accompanies this distribution.  The full text of the license may be found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Uefi.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/UefiRuntimeServicesTableLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-
-#include <Protocol/SimpleNetwork.h>
-#include <Protocol/PxeBaseCode.h>
-
-
-BOOLEAN   gUseIpv6 = FALSE;
-
-EFI_STATUS
-EFIAPI
-EblGetCurrentIpAddress (
-  IN OUT   EFI_IP_ADDRESS *Ip
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;
-  
-  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
-  Status = Pxe->Start (Pxe, gUseIpv6);
-  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
-    return Status;
-  }
-
-  CopyMem (Ip, &Pxe->Mode->StationIp, sizeof (EFI_IP_ADDRESS));
-
-  return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-EblGetCurrentMacAddress (
-  IN OUT  EFI_MAC_ADDRESS *Mac
-  )
-{
-  EFI_STATUS                    Status;
-  EFI_SIMPLE_NETWORK_PROTOCOL   *SimpleNet;
-
-  Status = gBS->LocateProtocol (&gEfiSimpleNetworkProtocolGuid, NULL, (VOID **)&SimpleNet);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
-  CopyMem (Mac, SimpleNet->Mode->CurrentAddress.Addr, sizeof (EFI_MAC_ADDRESS));
-  return Status;
-}
-
-
-CHAR8 *
-EFIAPI
-EblLoadFileBootTypeString (
-  IN  EFI_HANDLE Handle
-  )
-{
-  EFI_STATUS    Status;
-  VOID          *NullPtr;
-  
-  Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, &NullPtr);
-  if (!EFI_ERROR (Status)) {
-    return "EFI PXE Network Boot";
-  }
-  
-  return ""; 
-}
-
-EFI_STATUS
-EFIAPI
-EblPerformDHCP (
-  IN  BOOLEAN  SortOffers
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;
-  
-  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
-  Status = Pxe->Start (Pxe, gUseIpv6);
-  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
-    return Status;
-  }
-
-  Status = Pxe->Dhcp(Pxe, TRUE);
-  return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-EblSetStationIp (
-  IN EFI_IP_ADDRESS *NewStationIp,  OPTIONAL
-  IN EFI_IP_ADDRESS *NewSubnetMask  OPTIONAL
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;
-  
-  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
-  Status = Pxe->Start (Pxe, gUseIpv6);
-  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
-    return Status;
-  }
-     
-  Status = Pxe->SetStationIp (Pxe, NewStationIp, NewSubnetMask);
-  return Status;
-}
-
-  
-EFI_STATUS
-EFIAPI
-EblMtftp (
-  IN EFI_PXE_BASE_CODE_TFTP_OPCODE             Operation,
-  IN OUT VOID                                  *BufferPtr OPTIONAL,
-  IN BOOLEAN                                   Overwrite,
-  IN OUT UINT64                                *BufferSize,
-  IN UINTN                                     *BlockSize OPTIONAL,
-  IN EFI_IP_ADDRESS                            *ServerIp,
-  IN UINT8                                     *Filename  OPTIONAL,
-  IN EFI_PXE_BASE_CODE_MTFTP_INFO              *Info      OPTIONAL,
-  IN BOOLEAN                                   DontUseBuffer
-  )
-{
-  EFI_STATUS                  Status;
-  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;
-  
-  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-  
-  Status = Pxe->Mtftp (
-                  Pxe,
-                  Operation,
-                  BufferPtr,
-                  Overwrite,
-                  BufferSize,
-                  BlockSize,
-                  ServerIp,
-                  Filename,
-                  Info,
-                  DontUseBuffer
-                  );
-  return Status;
-}
-  
+/** @file\r
+\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  \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
+\r
+**/\r
+\r
+#include <Uefi.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+#include <Protocol/SimpleNetwork.h>\r
+#include <Protocol/PxeBaseCode.h>\r
+\r
+\r
+BOOLEAN   gUseIpv6 = FALSE;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+EblGetCurrentIpAddress (\r
+  IN OUT   EFI_IP_ADDRESS *Ip\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;\r
+  \r
+  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = Pxe->Start (Pxe, gUseIpv6);\r
+  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {\r
+    return Status;\r
+  }\r
+\r
+  CopyMem (Ip, &Pxe->Mode->StationIp, sizeof (EFI_IP_ADDRESS));\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+EblGetCurrentMacAddress (\r
+  IN OUT  EFI_MAC_ADDRESS *Mac\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_SIMPLE_NETWORK_PROTOCOL   *SimpleNet;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiSimpleNetworkProtocolGuid, NULL, (VOID **)&SimpleNet);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
+  CopyMem (Mac, SimpleNet->Mode->CurrentAddress.Addr, sizeof (EFI_MAC_ADDRESS));\r
+  return Status;\r
+}\r
+\r
+\r
+CHAR8 *\r
+EFIAPI\r
+EblLoadFileBootTypeString (\r
+  IN  EFI_HANDLE Handle\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  VOID          *NullPtr;\r
+  \r
+  Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, &NullPtr);\r
+  if (!EFI_ERROR (Status)) {\r
+    return "EFI PXE Network Boot";\r
+  }\r
+  \r
+  return ""; \r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+EblPerformDHCP (\r
+  IN  BOOLEAN  SortOffers\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;\r
+  \r
+  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = Pxe->Start (Pxe, gUseIpv6);\r
+  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = Pxe->Dhcp(Pxe, TRUE);\r
+  return Status;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+EblSetStationIp (\r
+  IN EFI_IP_ADDRESS *NewStationIp,  OPTIONAL\r
+  IN EFI_IP_ADDRESS *NewSubnetMask  OPTIONAL\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;\r
+  \r
+  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = Pxe->Start (Pxe, gUseIpv6);\r
+  if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {\r
+    return Status;\r
+  }\r
+     \r
+  Status = Pxe->SetStationIp (Pxe, NewStationIp, NewSubnetMask);\r
+  return Status;\r
+}\r
+\r
+  \r
+EFI_STATUS\r
+EFIAPI\r
+EblMtftp (\r
+  IN EFI_PXE_BASE_CODE_TFTP_OPCODE             Operation,\r
+  IN OUT VOID                                  *BufferPtr OPTIONAL,\r
+  IN BOOLEAN                                   Overwrite,\r
+  IN OUT UINT64                                *BufferSize,\r
+  IN UINTN                                     *BlockSize OPTIONAL,\r
+  IN EFI_IP_ADDRESS                            *ServerIp,\r
+  IN UINT8                                     *Filename  OPTIONAL,\r
+  IN EFI_PXE_BASE_CODE_MTFTP_INFO              *Info      OPTIONAL,\r
+  IN BOOLEAN                                   DontUseBuffer\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PXE_BASE_CODE_PROTOCOL  *Pxe;\r
+  \r
+  Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);\r
+  if (EFI_ERROR(Status)) {\r
+    return Status;\r
+  }\r
+  \r
+  Status = Pxe->Mtftp (\r
+                  Pxe,\r
+                  Operation,\r
+                  BufferPtr,\r
+                  Overwrite,\r
+                  BufferSize,\r
+                  BlockSize,\r
+                  ServerIp,\r
+                  Filename,\r
+                  Info,\r
+                  DontUseBuffer\r
+                  );\r
+  return Status;\r
+}\r
+  \r