]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Source fixes and cleanup for ARMGCC compiles
authorRandy Pawell <randy_pawell@hp.com>
Thu, 4 Dec 2014 00:32:24 +0000 (00:32 +0000)
committererictian <erictian@Edk2>
Thu, 4 Dec 2014 00:32:24 +0000 (00:32 +0000)
- Fix EFI_IPv4_ADDRESS usages to use a macro to copy the structure
  instead of direct assignment, to avoid runtime alignment errors.
- Fix a EFI_INPUT_KEY usage in TerminalDxe to use CopyMem()  to copy the
   structure instead of direct assignment, to avoid runtime alignment error.
- Delete excess local variables that are initialized but otherwise unused.
- CompilerIntrinsicsLib library now imported for AARCH64, as well as ARM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Randy Pawell <randy_pawell@hp.com>
Reviewed-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16471 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c
MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
MdeModulePkg/MdeModulePkg.dsc
MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Rrq.c
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c

index 4320549ed4f48a9f51baf28c8b36658edcddf1ed..468785807f5491bc26642dba3a2418bb220a8c78 100644 (file)
@@ -2,6 +2,7 @@
   NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows\r
   NVM Express specification.\r
 \r
+  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2013, 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
@@ -852,7 +853,6 @@ NvmExpressBuildDevicePath (
   IN OUT EFI_DEVICE_PATH_PROTOCOL                    **DevicePath\r
   )\r
 {\r
-  NVME_CONTROLLER_PRIVATE_DATA   *Private;\r
   NVME_NAMESPACE_DEVICE_PATH     *Node;\r
 \r
   //\r
@@ -862,8 +862,6 @@ NvmExpressBuildDevicePath (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  Private = NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU (This);\r
-\r
   if (NamespaceId == 0) {\r
     return EFI_NOT_FOUND;\r
   }\r
index 0ade9b231104748d8f5d11d589c84969941dddde..abf4f8f26a8e58e9e5c414fdb1da3ccda20f59dc 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   16550 UART Serial Port library functions\r
 \r
+  (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2006 - 2014, 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
@@ -184,7 +185,6 @@ GetSerialRegisterBase (
   )\r
 {\r
   UINTN                 PciLibAddress;\r
-  UINTN                 PrimaryBusNumber;\r
   UINTN                 BusNumber;\r
   UINTN                 SubordinateBusNumber;\r
   UINT32                ParentIoBase;\r
@@ -233,7 +233,6 @@ GetSerialRegisterBase (
     //\r
     // Retrieve and verify the bus numbers in the PCI to PCI Bridge\r
     //\r
-    PrimaryBusNumber     = PciRead8 (PciLibAddress + PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET);\r
     BusNumber            = PciRead8 (PciLibAddress + PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET);\r
     SubordinateBusNumber = PciRead8 (PciLibAddress + PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);\r
     if (BusNumber == 0 || BusNumber > SubordinateBusNumber) {\r
index 837a1dba4d0339abf31f533973f84000f824232c..cc93c2b89c01aaade9d1ef822348231d710acb18 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   IpIo Library.\r
 \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2005 - 2009, 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
@@ -703,7 +704,7 @@ IpIoCreateSndEntry (
 \r
     Ip4TxData = &TxData->Ip4TxData;\r
 \r
-    CopyMem (&Ip4TxData->DestinationAddress, Dest, sizeof (EFI_IPv4_ADDRESS));\r
+    IP4_COPY_ADDRESS (&Ip4TxData->DestinationAddress, Dest);\r
 \r
     Ip4TxData->OverrideData    = &OverrideData->Ip4OverrideData;\r
     Ip4TxData->OptionsLength   = 0;\r
@@ -1765,8 +1766,8 @@ IpIoConfigIp (
                   NULL\r
                   );\r
 \r
-        ((EFI_IP4_CONFIG_DATA*) IpConfigData)->StationAddress = Ip4ModeData.ConfigData.StationAddress;\r
-        ((EFI_IP4_CONFIG_DATA*) IpConfigData)->SubnetMask     = Ip4ModeData.ConfigData.SubnetMask;\r
+        IP4_COPY_ADDRESS (&((EFI_IP4_CONFIG_DATA*) IpConfigData)->StationAddress, &Ip4ModeData.ConfigData.StationAddress);\r
+        IP4_COPY_ADDRESS (&((EFI_IP4_CONFIG_DATA*) IpConfigData)->SubnetMask, &Ip4ModeData.ConfigData.SubnetMask);\r
     }\r
 \r
       CopyMem (\r
index f15dfdf23e83c4254316d25d973a0e3043df20fe..2b1c4d84c584be191037e8a7a1a0cda5128b2060 100644 (file)
@@ -1,6 +1,7 @@
 ## @file\r
 # EFI/PI Reference Module Package for All Architectures\r
 #\r
+# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #    This program and the accompanying materials\r
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf\r
 \r
-[LibraryClasses.ARM]\r
+[LibraryClasses.ARM, LibraryClasses.AARCH64]\r
   #\r
-  # It is not possible to prevent the ARM compiler for generic intrinsic functions.\r
-  # This library provides the instrinsic functions generate by a given compiler.\r
+  # It is not possible to prevent ARM compiler calls to generic intrinsic functions.\r
+  # This library provides the instrinsic functions generated by a given compiler.\r
   # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.\r
   #\r
   NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf\r
index 507f862de7baf656199d4cf60847b077b010b217..d789fbbc7562ce6318b2bcf1e6b20f2ea8ea108f 100644 (file)
@@ -9,6 +9,7 @@
   CapsuleDataCoalesce() will do basic validation before coalesce capsule data\r
   into memory.\r
 \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2011 - 2014, 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
@@ -960,7 +961,6 @@ CapsuleDataCoalesce (
   UINT8                          *DestPtr;\r
   UINTN                          DestLength;\r
   UINT8                          *RelocPtr;\r
-  UINT64                         *AddDataPtr;\r
   UINTN                          CapsuleTimes; \r
   UINT64                         SizeLeft; \r
   UINT64                         CapsuleImageSize; \r
@@ -986,7 +986,6 @@ CapsuleDataCoalesce (
   CapsuleTimes     = 0;\r
   CapsuleImageSize = 0;\r
   PrivateDataPtr   = NULL;\r
-  AddDataPtr       = NULL;\r
   CapsuleHeader    = NULL;\r
   CapsuleBeginFlag = TRUE;\r
   CapsuleSize      = 0;\r
index 1f29b61646f397ec509cde5f394be3c1da1589b5..4a008c9ada4fdc1bfd7d3c867764260a93497eeb 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Implementation for EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol.\r
 \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2014, 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
@@ -847,7 +848,7 @@ EfiKeyFiFoRemoveOneKey (
     return FALSE;\r
   }\r
 \r
-  *Output                         = TerminalDevice->EfiKeyFiFo->Data[Head];\r
+  CopyMem (Output, &TerminalDevice->EfiKeyFiFo->Data[Head], sizeof (EFI_INPUT_KEY));\r
 \r
   TerminalDevice->EfiKeyFiFo->Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));\r
 \r
index 03b7f28171a3e5befa9049ec1f9b7c97f141d401..7ed2e5250f1256d85dbd63ed57be08fd95179823 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Interface routine for Mtftp4.\r
   \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2014, 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
@@ -305,13 +306,13 @@ Mtftp4ConfigUnicastPort (
   UdpConfig.ReceiveTimeout     = 0;\r
   UdpConfig.TransmitTimeout    = 0;\r
   UdpConfig.UseDefaultAddress  = Config->UseDefaultSetting;\r
-  UdpConfig.StationAddress     = Config->StationIp;\r
-  UdpConfig.SubnetMask         = Config->SubnetMask;\r
+  IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp);\r
+  IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask);\r
   UdpConfig.StationPort        = 0;\r
   UdpConfig.RemotePort         = 0;\r
 \r
   Ip = HTONL (Instance->ServerIp);\r
-  CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+  IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip);\r
 \r
   Status = UdpIo->Protocol.Udp4->Configure (UdpIo->Protocol.Udp4, &UdpConfig);\r
 \r
index 21547ee3af8dadbc4a848a0ab37f7df4b48ab939..e983d7979192b453b726be4da6c8c96aa268bc51 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Routines to process Rrq (download).\r
   \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2014, 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
@@ -413,13 +414,13 @@ Mtftp4RrqConfigMcastPort (
   UdpConfig.ReceiveTimeout     = 0;\r
   UdpConfig.TransmitTimeout    = 0;\r
   UdpConfig.UseDefaultAddress  = Config->UseDefaultSetting;\r
-  UdpConfig.StationAddress     = Config->StationIp;\r
-  UdpConfig.SubnetMask         = Config->SubnetMask;\r
+  IP4_COPY_ADDRESS (&UdpConfig.StationAddress, &Config->StationIp);\r
+  IP4_COPY_ADDRESS (&UdpConfig.SubnetMask, &Config->SubnetMask);\r
   UdpConfig.StationPort        = Instance->McastPort;\r
   UdpConfig.RemotePort         = 0;\r
 \r
   Ip = HTONL (Instance->ServerIp);\r
-  CopyMem (&UdpConfig.RemoteAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+  IP4_COPY_ADDRESS (&UdpConfig.RemoteAddress, &Ip);\r
 \r
   Status = McastIo->Protocol.Udp4->Configure (McastIo->Protocol.Udp4, &UdpConfig);\r
 \r
@@ -451,7 +452,7 @@ Mtftp4RrqConfigMcastPort (
   // join the multicast group\r
   //\r
   Ip = HTONL (Instance->McastIp);\r
-  CopyMem (&Group, &Ip, sizeof (EFI_IPv4_ADDRESS));\r
+  IP4_COPY_ADDRESS (&Group, &Ip);\r
 \r
   return McastIo->Protocol.Udp4->Groups (McastIo->Protocol.Udp4, TRUE, &Group);\r
 }\r
index b6d89be2b17c665df5977ceb420c341ccb202bda..5b327af721c48ddb7b6db58c3abb3baba3298754 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   Tcp request dispatcher implementation.\r
 \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2005 - 2014, 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
@@ -101,11 +102,11 @@ Tcp4GetMode (
 \r
     AccessPoint->UseDefaultAddress  = Tcb->UseDefaultAddr;\r
 \r
-    CopyMem (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
-    AccessPoint->SubnetMask         = Tcb->SubnetMask;\r
+    IP4_COPY_ADDRESS (&AccessPoint->StationAddress, &Tcb->LocalEnd.Ip);\r
+    IP4_COPY_ADDRESS (&AccessPoint->SubnetMask, &Tcb->SubnetMask);\r
     AccessPoint->StationPort        = NTOHS (Tcb->LocalEnd.Port);\r
 \r
-    CopyMem (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip, sizeof (EFI_IPv4_ADDRESS));\r
+    IP4_COPY_ADDRESS (&AccessPoint->RemoteAddress, &Tcb->RemoteEnd.Ip);\r
     AccessPoint->RemotePort         = NTOHS (Tcb->RemoteEnd.Port);\r
     AccessPoint->ActiveFlag         = (BOOLEAN) (Tcb->State != TCP_LISTEN);\r
 \r
@@ -458,7 +459,7 @@ Tcp4ConfigurePcb (
 \r
   CopyMem (&Tcb->LocalEnd.Ip, &CfgData->AccessPoint.StationAddress, sizeof (IP4_ADDR));\r
   Tcb->LocalEnd.Port  = HTONS (CfgData->AccessPoint.StationPort);\r
-  Tcb->SubnetMask     = CfgData->AccessPoint.SubnetMask;\r
+  IP4_COPY_ADDRESS (&Tcb->SubnetMask, &CfgData->AccessPoint.SubnetMask);\r
 \r
   if (CfgData->AccessPoint.ActiveFlag) {\r
     CopyMem (&Tcb->RemoteEnd.Ip, &CfgData->AccessPoint.RemoteAddress, sizeof (IP4_ADDR));\r
index d33402078f6eece380568b9c6503c304a87dd491..5ea22acb14f96c4f71c7cb41134fc6c3b340dc3b 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
 \r
+(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2014, 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
@@ -227,8 +228,8 @@ Udp4Configure (
       // Save the configuration data.\r
       //\r
       CopyMem (&Instance->ConfigData, UdpConfigData, sizeof (Instance->ConfigData));\r
-      Instance->ConfigData.StationAddress = Ip4ConfigData.StationAddress;\r
-      Instance->ConfigData.SubnetMask     = Ip4ConfigData.SubnetMask;\r
+      IP4_COPY_ADDRESS (&Instance->ConfigData.StationAddress, &Ip4ConfigData.StationAddress);\r
+      IP4_COPY_ADDRESS (&Instance->ConfigData.SubnetMask, &Ip4ConfigData.SubnetMask);\r
 \r
       //\r
       // Try to allocate the required port resource.\r
@@ -588,7 +589,7 @@ Udp4Transmit (
   Udp4Header->Checksum     = 0;\r
 \r
   UdpSessionData = TxData->UdpSessionData;\r
-  Override.Ip4OverrideData.SourceAddress = ConfigData->StationAddress;\r
+  IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &ConfigData->StationAddress);\r
 \r
   if (UdpSessionData != NULL) {\r
     //\r
@@ -596,7 +597,7 @@ Udp4Transmit (
     // UdpSessionData.\r
     //\r
     if (!EFI_IP4_EQUAL (&UdpSessionData->SourceAddress, &mZeroIp4Addr)) {\r
-      CopyMem (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress, sizeof (EFI_IPv4_ADDRESS));\r
+      IP4_COPY_ADDRESS (&Override.Ip4OverrideData.SourceAddress, &UdpSessionData->SourceAddress);\r
     }\r
 \r
     if (UdpSessionData->SourcePort != 0) {\r
@@ -643,7 +644,7 @@ Udp4Transmit (
   // Fill the IpIo Override data.\r
   //\r
   if (TxData->GatewayAddress != NULL) {\r
-    CopyMem (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
+    IP4_COPY_ADDRESS (&Override.Ip4OverrideData.GatewayAddress, TxData->GatewayAddress);\r
   } else {\r
     ZeroMem (&Override.Ip4OverrideData.GatewayAddress, sizeof (EFI_IPv4_ADDRESS));\r
   }\r