diff --git a/MdeModulePkg/Include/Library/NetLib.h b/MdeModulePkg/Include/Library/NetLib.h index 6bc3431855..150b97936e 100644 --- a/MdeModulePkg/Include/Library/NetLib.h +++ b/MdeModulePkg/Include/Library/NetLib.h @@ -454,7 +454,7 @@ EFI_STATUS NetLibGetMacString ( IN EFI_HANDLE SnpHandle, IN EFI_HANDLE ImageHandle, - IN OUT CONST CHAR16 **MacString + IN OUT CHAR16 **MacString ); EFI_HANDLE diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c index 4a068eaf72..cfc8970c7c 100644 --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c @@ -229,7 +229,7 @@ IpIoIcmpHandler ( case ICMP_CODE_UNREACH_PROTOCOL: case ICMP_CODE_UNREACH_PORT: case ICMP_CODE_UNREACH_SRCFAIL: - IcmpErr = ICMP_ERR_UNREACH_NET + Code; + IcmpErr = (ICMP_ERROR) (ICMP_ERR_UNREACH_NET + Code); break; @@ -266,7 +266,7 @@ IpIoIcmpHandler ( return EFI_ABORTED; } - IcmpErr = Code + ICMP_ERR_TIMXCEED_INTRANS; + IcmpErr = (ICMP_ERROR) (Code + ICMP_ERR_TIMXCEED_INTRANS); break; @@ -654,7 +654,7 @@ IpIoListenHandler ( if (EFI_SUCCESS == Status) { - IpIo->PktRcvdNotify (EFI_SUCCESS, 0, &Session, Pkt, IpIo->RcvdContext); + IpIo->PktRcvdNotify (EFI_SUCCESS, (ICMP_ERROR) 0, &Session, Pkt, IpIo->RcvdContext); } else { // // Status is EFI_ICMP_ERROR @@ -1050,7 +1050,7 @@ IpIoAddIp ( IpIo->Controller, IpIo->Image, &IpInfo->ChildHandle, - &IpInfo->Ip + (VOID **) &IpInfo->Ip ); if (EFI_ERROR (Status)) { goto ReleaseIpInfo; diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c index 88dcf76a05..dcf2309c71 100644 --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c @@ -881,7 +881,7 @@ NetLibDefaultUnload ( Status = gBS->HandleProtocol ( DeviceHandleBuffer[Index], &gEfiDriverBindingProtocolGuid, - &DriverBinding + (VOID **) &DriverBinding ); if (EFI_ERROR (Status)) { @@ -897,24 +897,10 @@ NetLibDefaultUnload ( &gEfiDriverBindingProtocolGuid, DriverBinding ); -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) - Status = gBS->HandleProtocol ( - DeviceHandleBuffer[Index], - &gEfiComponentName2ProtocolGuid, - &ComponentName - ); - if (!EFI_ERROR (Status)) { - gBS->UninstallProtocolInterface ( - ImageHandle, - &gEfiComponentName2ProtocolGuid, - ComponentName - ); - } -#else Status = gBS->HandleProtocol ( DeviceHandleBuffer[Index], &gEfiComponentNameProtocolGuid, - &ComponentName + (VOID **) &ComponentName ); if (!EFI_ERROR (Status)) { gBS->UninstallProtocolInterface ( @@ -923,12 +909,11 @@ NetLibDefaultUnload ( ComponentName ); } -#endif Status = gBS->HandleProtocol ( DeviceHandleBuffer[Index], &gEfiDriverConfigurationProtocolGuid, - &DriverConfiguration + (VOID **) &DriverConfiguration ); if (!EFI_ERROR (Status)) { @@ -942,7 +927,7 @@ NetLibDefaultUnload ( Status = gBS->HandleProtocol ( DeviceHandleBuffer[Index], &gEfiDriverDiagnosticsProtocolGuid, - &DriverDiagnostics + (VOID **) &DriverDiagnostics ); if (!EFI_ERROR (Status)) { @@ -1085,7 +1070,7 @@ EFI_STATUS NetLibGetMacString ( IN EFI_HANDLE SnpHandle, IN EFI_HANDLE ImageHandle, - IN OUT CONST CHAR16 **MacString + IN OUT CHAR16 **MacString ) { EFI_STATUS Status; @@ -1126,7 +1111,7 @@ NetLibGetMacString ( // Convert the mac address into a unicode string. // for (Index = 0; Index < Mode->HwAddressSize; Index++) { - MacAddress[Index * 2] = NibbleToHexChar (Mode->CurrentAddress.Addr[Index] >> 4); + MacAddress[Index * 2] = NibbleToHexChar ((UINT8) (Mode->CurrentAddress.Addr[Index] >> 4)); MacAddress[Index * 2 + 1] = NibbleToHexChar (Mode->CurrentAddress.Addr[Index]); } diff --git a/MdeModulePkg/Library/DxeNetLib/NetDebug.c b/MdeModulePkg/Library/DxeNetLib/NetDebug.c index afcc1b3b42..ffaac1dbf7 100644 --- a/MdeModulePkg/Library/DxeNetLib/NetDebug.c +++ b/MdeModulePkg/Library/DxeNetLib/NetDebug.c @@ -214,7 +214,7 @@ SyslogSendPacket ( // // Get the recycled transmit buffer status. // - Snp->GetStatus (Snp, NULL, &TxBuf); + Snp->GetStatus (Snp, NULL, (VOID **) &TxBuf); if (!EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) { Status = EFI_TIMEOUT; @@ -375,7 +375,7 @@ SyslogBuildPacket ( // Len = 0; Len += (UINT32) AsciiSPrint ( - Buf, + (CHAR8 *) Buf, BufLen, "<%d> %a %d %d:%d:%d ", Pri, @@ -388,7 +388,7 @@ SyslogBuildPacket ( Len--; Len += (UINT32) AsciiSPrint ( - Buf + Len, + (CHAR8 *) (Buf + Len), BufLen - Len, "Tiano %a: %a (Line: %d File: %a)", Module, @@ -452,7 +452,7 @@ NetDebugASPrint ( } VA_START (Marker, Format); - AsciiVSPrint (Buf, NET_DEBUG_MSG_LEN, Format, Marker); + AsciiVSPrint ((CHAR8 *) Buf, NET_DEBUG_MSG_LEN, (CHAR8 *) Format, Marker); VA_END (Marker); return Buf; diff --git a/MdeModulePkg/Library/DxeNetLib/Netbuffer.c b/MdeModulePkg/Library/DxeNetLib/Netbuffer.c index f32e31efbe..a9de17f7e2 100644 --- a/MdeModulePkg/Library/DxeNetLib/Netbuffer.c +++ b/MdeModulePkg/Library/DxeNetLib/Netbuffer.c @@ -1711,7 +1711,7 @@ NetbufChecksum ( // The checksum starts with an odd byte, swap // the checksum before added to total checksum // - BlockSum = NET_SWAP_SHORT (BlockSum); + BlockSum = (UINT16) NET_SWAP_SHORT (BlockSum); } TotalSum = NetAddChecksum (BlockSum, TotalSum); diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c index 84bc295bb1..3a0075c467 100644 --- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c +++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c @@ -287,7 +287,7 @@ UdpIoCreatePort ( Status = gBS->OpenProtocol ( UdpIo->UdpHandle, &gEfiUdp4ProtocolGuid, - &UdpIo->Udp, + (VOID **) &UdpIo->Udp, Image, Controller, EFI_OPEN_PROTOCOL_BY_DRIVER diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 4334719e3e..9107e48ca2 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -55,8 +55,8 @@ [LibraryClasses.IPF] IoLib|$(WORKSPACE)/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf -[LibraryClasses.EBC] - +[LibraryClasses.EBC.DXE_RUNTIME_DRIVER] + IoLib|$(WORKSPACE)/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.inf [LibraryClasses.common.PEI_CORE] PeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c index c0cc15f3de..326fb4dc33 100644 --- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c +++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.c @@ -66,7 +66,7 @@ EfiNicIp4ConfigGetName ( } if (NicAddr != NULL) { - *NicAddr = Instance->NicAddr; + CopyMem (NicAddr, &Instance->NicAddr, sizeof (NIC_ADDR)); } return EFI_SUCCESS; @@ -628,7 +628,7 @@ Ip4ConfigOnDhcp4Complete ( goto ON_EXIT; } - Instance->NicConfig->NicAddr = Instance->NicAddr; + CopyMem (&Instance->NicConfig->NicAddr, &Instance->NicAddr, sizeof (NIC_ADDR)); Instance->NicConfig->Source = IP4_CONFIG_SOURCE_DHCP; Instance->NicConfig->Perment = Perment; diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h index 90e55993c2..8c58c8078c 100644 --- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h +++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4Config.h @@ -52,7 +52,7 @@ enum { DHCP_TAG_PARA_LIST = 55, DHCP_TAG_NETMASK = 1, - DHCP_TAG_ROUTER = 3, + DHCP_TAG_ROUTER = 3 }; // @@ -66,7 +66,7 @@ typedef struct { } IP4_CONFIG_DHCP4_OPTION; #pragma pack() -typedef struct _IP4_CONFIG_INSTANCE { +struct _IP4_CONFIG_INSTANCE { UINT32 Signature; EFI_HANDLE Controller; EFI_HANDLE Image; diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c index 342b7d96b8..265135a117 100644 --- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c +++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDriver.c @@ -173,7 +173,7 @@ Ip4ConfigDriverBindingStart ( Status = gBS->OpenProtocol ( ControllerHandle, &gEfiIp4ConfigProtocolGuid, - &Ip4Config, + (VOID **) &Ip4Config, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL @@ -252,7 +252,7 @@ Ip4ConfigDriverBindingStart ( Instance->NicAddr.Type = (UINT16) SnpMode.IfType; Instance->NicAddr.Len = (UINT8) SnpMode.HwAddressSize; - Instance->NicAddr.MacAddr = SnpMode.CurrentAddress; + CopyMem (&Instance->NicAddr.MacAddr, &SnpMode.CurrentAddress, sizeof (EFI_MAC_ADDRESS)); // // Add it to the global list, and compose the name diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c index ac5283f6d6..d6e617eaa7 100644 --- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c +++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c @@ -150,7 +150,7 @@ Ip4ConfigReadVariable ( // // Verify the checksum, variable size and count // - CheckSum = ~NetblockChecksum ((UINT8 *) Variable, (UINT32)Size); + CheckSum = (UINT16) (~NetblockChecksum ((UINT8 *) Variable, (UINT32)Size)); if ((CheckSum != 0) || (Size != Variable->Len)) { goto REMOVE_VARIABLE; @@ -378,6 +378,6 @@ Ip4ConfigModifyVariable ( ASSERT (Next + Len == (UINT8 *) NewVar + TotalLen); - NewVar->CheckSum = ~NetblockChecksum ((UINT8 *) NewVar, TotalLen); + NewVar->CheckSum = (UINT16) (~NetblockChecksum ((UINT8 *) NewVar, TotalLen)); return NewVar; } diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c index c842991f30..5a648f5ffc 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c @@ -523,12 +523,12 @@ MnpInitializeInstanceData ( // // Copy the MNP Protocol interfaces from the template. // - Instance->ManagedNetwork = mMnpProtocolTemplate; + CopyMem (&Instance->ManagedNetwork, &mMnpProtocolTemplate, sizeof (EFI_MANAGED_NETWORK_PROTOCOL)); // // Copy the default config data. // - Instance->ConfigData = mMnpDefaultConfigData; + CopyMem (&Instance->ConfigData, &mMnpDefaultConfigData, sizeof (EFI_MANAGED_NETWORK_CONFIG_DATA)); // // Initialize the lists. @@ -1024,7 +1024,7 @@ MnpConfigureInstance ( // // Save the new configuration data. // - *OldConfigData = *NewConfigData; + CopyMem (OldConfigData, NewConfigData, sizeof (EFI_MANAGED_NETWORK_CONFIG_DATA)); Instance->Configured = (BOOLEAN) (ConfigData != NULL); @@ -1035,7 +1035,7 @@ MnpConfigureInstance ( Status = MnpStart ( MnpServiceData, IsConfigUpdate, - !NewConfigData->DisableBackgroundPolling + (BOOLEAN) !NewConfigData->DisableBackgroundPolling ); } else { // @@ -1138,7 +1138,7 @@ MnpConfigReceiveFilters ( NET_LIST_FOR_EACH (Entry, &MnpServiceData->GroupAddressList) { GroupAddress = NET_LIST_USER_STRUCT (Entry, MNP_GROUP_ADDRESS, AddrEntry); - *(MCastFilter + Index) = GroupAddress->Address; + CopyMem (MCastFilter + Index, &GroupAddress->Address, sizeof (EFI_MAC_ADDRESS)); Index++; ASSERT (Index <= MCastFilterCnt); @@ -1252,7 +1252,7 @@ MnpGroupOpAddCtrlBlk ( return EFI_OUT_OF_RESOURCES; } - GroupAddress->Address = *MacAddress; + CopyMem (&GroupAddress->Address, MacAddress, sizeof (EFI_MAC_ADDRESS)); GroupAddress->RefCnt = 0; NetListInsertTail ( &MnpServiceData->GroupAddressList, diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c index cde235912f..91b8d4e0b8 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpIo.c @@ -43,7 +43,6 @@ MnpIsValidTxToken ( ) { MNP_SERVICE_DATA *MnpServiceData; - EFI_SIMPLE_NETWORK_MODE *SnpMode; EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData; UINT32 Index; UINT32 TotalLength; @@ -52,7 +51,6 @@ MnpIsValidTxToken ( MnpServiceData = Instance->MnpServiceData; NET_CHECK_SIGNATURE (MnpServiceData, MNP_SERVICE_DATA_SIGNATURE); - SnpMode = MnpServiceData->Snp->Mode; TxData = Token->Packet.TxData; if ((Token->Event == NULL) || (TxData == NULL) || (TxData->FragmentCount == 0)) { @@ -262,7 +260,7 @@ MnpSyncSendPacket ( // // Get the recycled transmit buffer status. // - Snp->GetStatus (Snp, NULL, &TxBuf); + Snp->GetStatus (Snp, NULL, (VOID **) &TxBuf); if (!EFI_ERROR (gBS->CheckEvent (MnpServiceData->TxTimeoutEvent))) { @@ -749,7 +747,7 @@ MnpWrapRxData ( // // Fill the RxData in RxDataWrap, // - RxDataWrap->RxData = *RxData; + CopyMem (&RxDataWrap->RxData, RxData, sizeof (EFI_MANAGED_NETWORK_RECEIVE_DATA)); // // Create the recycle event. @@ -829,7 +827,7 @@ MnpEnqueuePacket ( // // Wrap the RxData. // - RxDataWrap = MnpWrapRxData (Instance, &RxData); + CopyMem (&RxDataWrap, MnpWrapRxData (Instance, &RxData), sizeof (MNP_RXDATA_WRAP)); if (RxDataWrap == NULL) { continue; } diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c index 02c0065c34..ccd82d0e87 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c @@ -68,7 +68,7 @@ MnpGetModeData ( // // Copy the instance configuration data. // - *MnpConfigData = Instance->ConfigData; + CopyMem (MnpConfigData, &Instance->ConfigData, sizeof (EFI_MANAGED_NETWORK_CONFIG_DATA)); } if (SnpModeData != NULL) { @@ -76,7 +76,7 @@ MnpGetModeData ( // Copy the underlayer Snp mode data. // Snp = Instance->MnpServiceData->Snp; - *SnpModeData = *(Snp->Mode); + CopyMem (SnpModeData, Snp->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE)); } if (!Instance->Configured) { @@ -229,7 +229,7 @@ MnpMcastIpToMac ( MacAddress->Addr[0] = 0x01; MacAddress->Addr[1] = 0x00; MacAddress->Addr[2] = 0x5E; - MacAddress->Addr[3] = IpAddress->v4.Addr[1] & 0x7F; + MacAddress->Addr[3] = (UINT8) (IpAddress->v4.Addr[1] & 0x7F); MacAddress->Addr[4] = IpAddress->v4.Addr[2]; MacAddress->Addr[5] = IpAddress->v4.Addr[3]; diff --git a/MdeModulePkg/Universal/Network/SnpDxe/reset.c b/MdeModulePkg/Universal/Network/SnpDxe/reset.c index 0a08032fc4..cc869eb320 100644 --- a/MdeModulePkg/Universal/Network/SnpDxe/reset.c +++ b/MdeModulePkg/Universal/Network/SnpDxe/reset.c @@ -97,6 +97,7 @@ snp_undi32_reset ( // Resolve Warning 4 unreferenced parameter problem // ExtendedVerification = 0; + DEBUG ((EFI_D_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification)); if (this == NULL) { return EFI_INVALID_PARAMETER; diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c index 1f81fc39d3..bc70403698 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockImpl.c @@ -76,7 +76,7 @@ SockTcpDataToRcv ( TcpRsvData = (TCP_RSV_DATA *) RcvBufEntry->ProtoData; - *IsUrg = ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE); + *IsUrg = (BOOLEAN) ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE); if (*IsUrg && TcpRsvData->UrgLen < RcvBufEntry->TotalSize) { @@ -100,7 +100,7 @@ SockTcpDataToRcv ( TcpRsvData = (TCP_RSV_DATA *) RcvBufEntry->ProtoData; - Urg = ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE); + Urg = (BOOLEAN) ((TcpRsvData->UrgLen > 0) ? TRUE : FALSE); if (*IsUrg != Urg) { break; @@ -165,7 +165,7 @@ SockSetTcpRxData ( for (Index = 0; (Index < RxData->FragmentCount) && (RcvdBytes > 0); Index++) { Fragment = &RxData->FragmentTable[Index]; - CopyBytes = NET_MIN (Fragment->FragmentLength, RcvdBytes); + CopyBytes = NET_MIN ((UINT32) (Fragment->FragmentLength), RcvdBytes); NetbufQueCopy ( Sock->RcvBuffer.DataQueue, @@ -209,7 +209,7 @@ SockProcessRcvToken ( TokenRcvdBytes = SockTcpDataToRcv ( &Sock->RcvBuffer, &IsUrg, - RxData->DataLength + (UINT32) RxData->DataLength ); // @@ -254,7 +254,7 @@ SockProcessTcpSndData ( // SndData = NetbufFromExt ( (NET_FRAGMENT *) TxData->FragmentTable, - TxData->FragmentCount, + (UINT32) TxData->FragmentCount, 0, 0, SockFreeFoo, @@ -518,7 +518,7 @@ SockProcessSndToken ( SndToken = (SOCK_IO_TOKEN *) SockToken->Token; TxData = SndToken->Packet.TxData; - DataLen = TxData->DataLength; + DataLen = (UINT32) TxData->DataLength; Status = SockProcessTcpSndData (Sock, TxData); if (EFI_ERROR (Status)) { diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c index 0b71996e14..cde02b2bec 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c @@ -571,7 +571,7 @@ SockSend ( goto Exit; } - DataLen = TxData->DataLength; + DataLen = (UINT32) TxData->DataLength; // // process this sending token now or buffer it only? diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h index f3978541fb..7c219e3b9b 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Socket.h @@ -320,7 +320,7 @@ SockRcvdErr ( // // the socket structure representing a network service access point // -typedef struct _SOCKET { +struct _SOCKET { // // socket description information @@ -365,7 +365,7 @@ typedef struct _SOCKET { EFI_TCP4_PROTOCOL TcpProtocol; EFI_UDP4_PROTOCOL UdpProtocol; } NetProtocol; -} SOCKET; +}; // // the token structure buffered in socket layer diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c index 9039905be6..ea7d732b84 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c @@ -104,7 +104,7 @@ Tcp4GetMode ( } if (Mode->Tcp4State) { - *(Mode->Tcp4State) = Tcb->State; + *(Mode->Tcp4State) = (EFI_TCP4_CONNECTION_STATE) Tcb->State; } if (Mode->Tcp4ConfigData) { @@ -139,9 +139,10 @@ Tcp4GetMode ( Option->KeepAliveTime = Tcb->KeepAliveIdle / TCP_TICK_HZ; Option->KeepAliveInterval = Tcb->KeepAlivePeriod / TCP_TICK_HZ; - Option->EnableNagle = !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE); - Option->EnableTimeStamp = !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS); - Option->EnableWindowScaling = !TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS); + Option->EnableNagle = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_NAGLE)); + Option->EnableTimeStamp = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_TS)); + Option->EnableWindowScaling = (BOOLEAN) (!TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_NO_WS)) +; Option->EnableSelectiveAck = FALSE; Option->EnablePathMtuDiscovery = FALSE; @@ -341,7 +342,6 @@ Tcp4ConfigurePcb ( IN EFI_TCP4_CONFIG_DATA *CfgData ) { - IP_IO *IpIo; EFI_IP4_CONFIG_DATA IpCfgData; EFI_STATUS Status; EFI_TCP4_OPTION *Option; @@ -352,14 +352,13 @@ Tcp4ConfigurePcb ( TcpProto = (TCP4_PROTO_DATA *) Sk->ProtoReserved; Tcb = TcpProto->TcpPcb; - IpIo = TcpProto->TcpService->IpIo; ASSERT (Tcb != NULL); // // Add Ip for send pkt to the peer // - IpCfgData = mIpIoDefaultIpConfigData; + CopyMem (&IpCfgData, &mIpIoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA)); IpCfgData.DefaultProtocol = EFI_IP_PROTO_TCP; IpCfgData.UseDefaultAddress = CfgData->AccessPoint.UseDefaultAddress; IpCfgData.StationAddress = CfgData->AccessPoint.StationAddress; @@ -441,25 +440,34 @@ Tcp4ConfigurePcb ( if (Option != NULL) { SET_RCV_BUFFSIZE ( Sk, - TCP_COMP_VAL (TCP_RCV_BUF_SIZE_MIN, - TCP_RCV_BUF_SIZE, - TCP_RCV_BUF_SIZE, - Option->ReceiveBufferSize) + (UINT32) (TCP_COMP_VAL ( + TCP_RCV_BUF_SIZE_MIN, + TCP_RCV_BUF_SIZE, + TCP_RCV_BUF_SIZE, + Option->ReceiveBufferSize + ) + ) ); SET_SND_BUFFSIZE ( Sk, - TCP_COMP_VAL (TCP_SND_BUF_SIZE_MIN, - TCP_SND_BUF_SIZE, - TCP_SND_BUF_SIZE, - Option->SendBufferSize) + (UINT32) (TCP_COMP_VAL ( + TCP_SND_BUF_SIZE_MIN, + TCP_SND_BUF_SIZE, + TCP_SND_BUF_SIZE, + Option->SendBufferSize + ) + ) ); SET_BACKLOG ( Sk, - TCP_COMP_VAL (TCP_BACKLOG_MIN, - TCP_BACKLOG, - TCP_BACKLOG, - Option->MaxSynBackLog) + (UINT32) (TCP_COMP_VAL ( + TCP_BACKLOG_MIN, + TCP_BACKLOG, + TCP_BACKLOG, + Option->MaxSynBackLog + ) + ) ); Tcb->MaxRexmit = (UINT16) TCP_COMP_VAL ( @@ -472,7 +480,7 @@ Tcp4ConfigurePcb ( TCP_FIN_WAIT2_TIME, TCP_FIN_WAIT2_TIME_MAX, TCP_FIN_WAIT2_TIME, - Option->FinTimeout * TCP_TICK_HZ + (UINT32) (Option->FinTimeout * TCP_TICK_HZ) ); if (Option->TimeWaitTimeout != 0) { @@ -480,7 +488,7 @@ Tcp4ConfigurePcb ( TCP_TIME_WAIT_TIME, TCP_TIME_WAIT_TIME_MAX, TCP_TIME_WAIT_TIME, - Option->TimeWaitTimeout * TCP_TICK_HZ + (UINT32) (Option->TimeWaitTimeout * TCP_TICK_HZ) ); } else { Tcb->TimeWaitTimeout = 0; @@ -499,13 +507,13 @@ Tcp4ConfigurePcb ( TCP_KEEPALIVE_IDLE_MIN, TCP_KEEPALIVE_IDLE_MAX, TCP_KEEPALIVE_IDLE_MIN, - Option->KeepAliveTime * TCP_TICK_HZ + (UINT32) (Option->KeepAliveTime * TCP_TICK_HZ) ); Tcb->KeepAlivePeriod = TCP_COMP_VAL ( TCP_KEEPALIVE_PERIOD_MIN, TCP_KEEPALIVE_PERIOD, TCP_KEEPALIVE_PERIOD, - Option->KeepAliveInterval * TCP_TICK_HZ + (UINT32) (Option->KeepAliveInterval * TCP_TICK_HZ) ); } @@ -513,7 +521,7 @@ Tcp4ConfigurePcb ( TCP_CONNECT_TIME_MIN, TCP_CONNECT_TIME, TCP_CONNECT_TIME, - Option->ConnectionTimeout * TCP_TICK_HZ + (UINT32) (Option->ConnectionTimeout * TCP_TICK_HZ) ); if (Option->EnableNagle == FALSE) { diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c index 2927849285..002cd61089 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Driver.c @@ -44,7 +44,7 @@ EFI_TCP4_PROTOCOL mTcp4ProtocolTemplate = { SOCK_INIT_DATA mTcp4DefaultSockData = { SOCK_STREAM, - 0, + (SOCK_STATE) 0, NULL, TCP_BACKLOG, TCP_SND_BUF_SIZE, @@ -192,8 +192,8 @@ Returns: // Seed = NetRandomInitSeed (); mTcpGlobalIss = NET_RANDOM (Seed) % mTcpGlobalIss; - mTcp4RandomPort = TCP4_PORT_KNOWN + - (UINT16) (NET_RANDOM(Seed) % TCP4_PORT_KNOWN); + mTcp4RandomPort = (UINT16) ( TCP4_PORT_KNOWN + + (UINT16) (NET_RANDOM(Seed) % TCP4_PORT_KNOWN)); return Status; } @@ -306,7 +306,7 @@ Tcp4DriverBindingStart ( // NetZeroMem (&OpenData, sizeof (IP_IO_OPEN_DATA)); - OpenData.IpConfigData = mIpIoDefaultIpConfigData; + CopyMem (&OpenData.IpConfigData, &mIpIoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA)); OpenData.IpConfigData.DefaultProtocol = EFI_IP_PROTO_TCP; OpenData.PktRcvdNotify = Tcp4RxCallback; diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c index 8a8cd8a9e3..8f5a997957 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Main.c @@ -48,7 +48,7 @@ Tcp4ChkDataBuf ( UINT32 Len; for (Index = 0, Len = 0; Index < FragmentCount; Index++) { - Len = Len + FragmentTable[Index].FragmentLength; + Len = Len + (UINT32) FragmentTable[Index].FragmentLength; } if (DataLen != Len) { @@ -380,8 +380,8 @@ Tcp4Transmit ( } Status = Tcp4ChkDataBuf ( - Token->Packet.TxData->DataLength, - Token->Packet.TxData->FragmentCount, + (UINT32) Token->Packet.TxData->DataLength, + (UINT32) Token->Packet.TxData->FragmentCount, Token->Packet.TxData->FragmentTable ); if (EFI_ERROR (Status)) { @@ -447,8 +447,8 @@ Tcp4Receive ( } Status = Tcp4ChkDataBuf ( - Token->Packet.RxData->DataLength, - Token->Packet.RxData->FragmentCount, + (UINT32) Token->Packet.RxData->DataLength, + (UINT32) Token->Packet.RxData->FragmentCount, Token->Packet.RxData->FragmentTable ); if (EFI_ERROR (Status)) { diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c index 7f1f141bc8..9cb55a567d 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c @@ -123,7 +123,7 @@ TcpInitTcbPeer ( } if (TCP_FLG_ON (Opt->Flag, TCP_OPTION_RCVD_MSS)) { - Tcb->SndMss = NET_MAX (64, Opt->Mss); + Tcb->SndMss = (UINT16) NET_MAX (64, Opt->Mss); RcvMss = TcpGetRcvMss (Tcb->Sk); if (Tcb->SndMss > RcvMss) { @@ -568,7 +568,7 @@ TcpChecksum ( HTONS ((UINT16) Nbuf->TotalSize) ); - return ~Checksum; + return (UINT16) ~Checksum; } @@ -806,6 +806,7 @@ TcpOnAppConsume ( IN TCP_CB *Tcb ) { + UINT32 TcpOld; switch (Tcb->State) { case TCP_CLOSED: @@ -822,9 +823,10 @@ TcpOnAppConsume ( break; case TCP_ESTABLISHED: - if (TcpRcvWinNow (Tcb) > TcpRcvWinOld (Tcb)) { + TcpOld = TcpRcvWinOld (Tcb); + if (TcpRcvWinNow (Tcb) > TcpOld) { - if (TcpRcvWinOld (Tcb) < Tcb->RcvMss) { + if (TcpOld < Tcb->RcvMss) { TCP4_DEBUG_TRACE (("TcpOnAppConsume: send a window" " update for a window closed Tcb(%x)\n", Tcb)); diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c index d430a2e10d..b81f442a6f 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.c @@ -114,7 +114,7 @@ TcpSynBuildOption ( IN NET_BUF *Nbuf ) { - char *Data; + UINT8 *Data; UINT16 Len; ASSERT (Tcb && Nbuf && !Nbuf->Tcp); @@ -193,7 +193,7 @@ TcpBuildOption ( IN NET_BUF *Nbuf ) { - char *Data; + UINT8 *Data; UINT16 Len; ASSERT (Tcb && Nbuf && !Nbuf->Tcp); @@ -303,7 +303,7 @@ TcpParseOption ( return -1; } - Option->WndScale = NET_MIN (14, Head[Cur + 2]); + Option->WndScale = (UINT8) NET_MIN (14, Head[Cur + 2]); TCP_SET_FLG (Option->Flag, TCP_OPTION_RCVD_WS); Cur += TCP_OPTION_WS_LEN; @@ -340,7 +340,7 @@ TcpParseOption ( return -1; } - Cur = Cur + Len; + Cur = (UINT8) (Cur + Len); break; } diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h index 8074cb5564..cae0e885cf 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Option.h @@ -72,7 +72,7 @@ enum { TCP_OPTION_MAX_WIN = 0xffff, // max window size in TCP header TCP_OPTION_RCVD_MSS = 0x01, TCP_OPTION_RCVD_WS = 0x02, - TCP_OPTION_RCVD_TS = 0x04, + TCP_OPTION_RCVD_TS = 0x04 }; UINT8 diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c index f2987e769c..870403fa2e 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c @@ -1003,6 +1003,9 @@ TcpToSendAck ( IN TCP_CB *Tcb ) { + UINT32 TcpNow; + + TcpNow = TcpRcvWinNow (Tcb); // // Generally, TCP should send a delayed ACK unless: // 1. ACK at least every other FULL sized segment received, @@ -1011,7 +1014,7 @@ TcpToSendAck ( // if (TCP_FLG_ON (Tcb->CtrlFlag, TCP_CTRL_ACK_NOW) || (Tcb->DelayedAck >= 1) || - (TcpRcvWinNow (Tcb) > TcpRcvWinOld (Tcb)) + (TcpNow > TcpRcvWinOld (Tcb)) ) { TcpSendAck (Tcb); return; diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h index 03daa6f04e..a35a51b3cc 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h @@ -42,7 +42,7 @@ enum { TCP_CLOSING, TCP_TIME_WAIT, TCP_CLOSE_WAIT, - TCP_LAST_ACK, + TCP_LAST_ACK }; // @@ -56,7 +56,7 @@ enum { TCP_FLG_PSH = 0x08, TCP_FLG_ACK = 0x10, TCP_FLG_URG = 0x20, - TCP_FLG_FLAG = 0x3F, // mask for all the flags + TCP_FLG_FLAG = 0x3F // mask for all the flags }; enum { @@ -144,7 +144,7 @@ enum { TCP_KEEPALIVE_IDLE_MAX = TCP_TICK_HZ *60 *60 *4, TCP_KEEPALIVE_PERIOD_MIN= TCP_TICK_HZ *30, TCP_FIN_WAIT2_TIME_MAX = 4 *TCP_TICK_HZ, - TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ, + TCP_TIME_WAIT_TIME_MAX = 60 *TCP_TICK_HZ }; typedef struct _TCP_SEG { @@ -165,7 +165,7 @@ typedef struct _TCP_PEER { // // tcp control block, it includes various states // -typedef struct _TCP_CB { +struct _TCP_CB { NET_LIST_ENTRY List; TCP_CB *Parent; @@ -269,7 +269,7 @@ typedef struct _TCP_CB { // pointer reference to Ip used to send pkt // IP_IO_IP_INFO *IpInfo; -} TCP_CB; +}; extern NET_LIST_ENTRY mTcpRunQue; extern NET_LIST_ENTRY mTcpListenQue; @@ -336,8 +336,8 @@ extern UINT32 mTcpTick; (((Pb)->Port == 0) || ((Pb)->Port == (Pa)->Port))) #define TCP_TIMER_ON(Flag, Timer) ((Flag) & (1 << (Timer))) -#define TCP_SET_TIMER(Flag, Timer) ((Flag) |= (1 << (Timer))) -#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) &= ~(1 << (Timer))) +#define TCP_SET_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) | (1 << (Timer)))) +#define TCP_CLEAR_TIMER(Flag, Timer) ((Flag) = (UINT16) ((Flag) & (~(1 << (Timer))))) #define TCP_TIME_LT(Ta, Tb) ((INT32) ((Ta) - (Tb)) < 0) #define TCP_TIME_LEQ(Ta, Tb) ((INT32) ((Ta) - (Tb)) <= 0) diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c index dd7522e91f..e6fddd8052 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Impl.c @@ -172,7 +172,7 @@ Udp4CreateService ( // // Set the OpenData used to open the IpIo. // - OpenData.IpConfigData = mIpIoDefaultIpConfigData; + CopyMem (&OpenData.IpConfigData, &mIpIoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA)); OpenData.IpConfigData.AcceptBroadcast = TRUE; OpenData.RcvdContext = (VOID *) Udp4Service; OpenData.SndContext = NULL; @@ -359,7 +359,7 @@ Udp4InitInstance ( // Save the pointer to the UDP4_SERVICE_DATA, and initialize other members. // Instance->Udp4Service = Udp4Service; - Instance->Udp4Proto = mUdp4Protocol; + CopyMem (&Instance->Udp4Proto, &mUdp4Protocol, sizeof (EFI_UDP4_PROTOCOL)); Instance->IcmpError = EFI_SUCCESS; Instance->Configured = FALSE; Instance->IsNoMapping = FALSE; @@ -613,7 +613,8 @@ Udp4BuildIp4ConfigData ( IN EFI_IP4_CONFIG_DATA *Ip4ConfigData ) { - *Ip4ConfigData = mIpIoDefaultIpConfigData; + CopyMem (Ip4ConfigData, &mIpIoDefaultIpConfigData, sizeof (EFI_IP4_CONFIG_DATA)); + Ip4ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP; Ip4ConfigData->AcceptBroadcast = Udp4ConfigData->AcceptBroadcast; Ip4ConfigData->AcceptPromiscuous = Udp4ConfigData->AcceptPromiscuous; @@ -1280,7 +1281,7 @@ Udp4WrapRxData ( NetListInit (&Wrap->Link); - Wrap->RxData = *RxData; + CopyMem (&Wrap->RxData, RxData, sizeof (EFI_UDP4_RECEIVE_DATA)); // // Create the Recycle event. @@ -1345,7 +1346,7 @@ Udp4EnqueueDgram ( // // Wrap the RxData and put this Wrap into the instances RcvdDgramQue. // - Wrap = Udp4WrapRxData (Instance, Packet, RxData); + CopyMem (&Wrap, Udp4WrapRxData (Instance, Packet, RxData), sizeof (UDP4_RXDATA_WRAP)); if (Wrap == NULL) { continue; } diff --git a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c index 4f897cb54b..5343bd5c4b 100644 --- a/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c +++ b/MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Main.c @@ -86,7 +86,7 @@ Udp4GetModeData ( // // Set the Udp4ConfigData. // - *Udp4ConfigData = Instance->ConfigData; + CopyMem (Udp4ConfigData, &Instance->ConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); } Ip = Instance->IpInfo->Ip; @@ -232,7 +232,7 @@ Udp4Configure ( // // Save the configuration data. // - Instance->ConfigData = *UdpConfigData; + CopyMem (&Instance->ConfigData, UdpConfigData, sizeof (EFI_UDP4_CONFIG_DATA)); Instance->ConfigData.StationAddress = Ip4ConfigData.StationAddress; Instance->ConfigData.SubnetMask = Ip4ConfigData.SubnetMask;