summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Bus/Pci/UndiRuntimeDxe/E100b.c94
-rw-r--r--MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c13
-rw-r--r--MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf1
-rw-r--r--MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c27
-rw-r--r--MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf1
-rw-r--r--MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c9
-rw-r--r--MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c2
7 files changed, 83 insertions, 64 deletions
diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/E100b.c b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/E100b.c
index 4ca431c..2bd7813 100644
--- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/E100b.c
+++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/E100b.c
@@ -1,17 +1,17 @@
/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. 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.
+Copyright (c) 2006, Intel Corporation
+All rights reserved. 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.
Module Name:
-
-
+
+
E100B.C
Abstract:
@@ -33,7 +33,7 @@ static UINT8 basic_config_cmd[22] = {
0x60, 0,
(UINT8)0xf2, 0x48,
0, 0x40,
- (UINT8)0xf2, (UINT8)0x80, // 0x40=Force full-duplex
+ (UINT8)0xf2, (UINT8)0x80, // 0x40=Force full-duplex
0x3f, 0x05,
};
@@ -61,9 +61,9 @@ Routine Description:
This function calls the MemIo callback to read a byte from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
-
+
Arguments:
Port - Which port to read from.
@@ -76,9 +76,9 @@ Returns:
UINT8 Results;
(*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_READ,
- 1,
+ AdapterInfo->Unique_ID,
+ PXE_MEM_READ,
+ 1,
(UINT64)Port,
(UINT64) (UINTN) &Results
);
@@ -96,7 +96,7 @@ Routine Description:
This function calls the MemIo callback to read a word from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
Arguments:
@@ -131,7 +131,7 @@ Routine Description:
This function calls the MemIo callback to read a dword from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
Arguments:
@@ -167,7 +167,7 @@ Routine Description:
This function calls the MemIo callback to write a byte from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
Arguments:
@@ -205,7 +205,7 @@ Routine Description:
This function calls the MemIo callback to write a word from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
Arguments:
@@ -243,7 +243,7 @@ Routine Description:
This function calls the MemIo callback to write a dword from the device's
address space
Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
+ which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
to make undi3.0 a special case
Arguments:
@@ -854,7 +854,7 @@ Returns:
AdapterInfo->rx_phy_addr = AdapterInfo->Mapped_MemoryPtr;
AdapterInfo->tx_phy_addr = AdapterInfo->Mapped_MemoryPtr + rx_size;
AdapterInfo->stat_phy_addr = AdapterInfo->tx_phy_addr + tx_size;
-
+
//
// auto detect.
//
@@ -1559,7 +1559,7 @@ Returns:
cur_ptr[Index].PhysTCBAddress =
(UINT32) AdapterInfo->tx_phy_addr + (Index * sizeof (TxCB));
- cur_ptr[Index].PhysArrayAddr = (UINT32)(cur_ptr[Index].PhysTCBAddress + array_off);
+ cur_ptr[Index].PhysArrayAddr = (UINT32)(cur_ptr[Index].PhysTCBAddress + array_off);
cur_ptr[Index].PhysTBDArrayAddres = (UINT32)(cur_ptr[Index].PhysTCBAddress + array_off);
cur_ptr->free_data_ptr = (UINT64) 0;
@@ -2032,7 +2032,7 @@ Returns:
UINTN wait;
UINT8 tmp;
- if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
+ if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
(AdapterInfo->RevID >= D102_REVID)) {
wait = 500;
@@ -2074,12 +2074,12 @@ Arguments:
Returns:
None
-
+
--*/
{
UINT8 tmp;
- if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
+ if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
(AdapterInfo->RevID >= D102_REVID)) {
tmp = InByte (AdapterInfo, AdapterInfo->ioaddr + SCBGenCtrl2);
@@ -2396,7 +2396,7 @@ Returns:
db.Data[0x08] = AdapterInfo->statistics->rx_crc_errs +
AdapterInfo->statistics->rx_align_errs;
- db.Data[0x04] = db.Data[0x02] +
+ db.Data[0x04] = db.Data[0x02] +
db.Data[0x08] +
AdapterInfo->statistics->rx_resource_errs +
AdapterInfo->statistics->rx_overrun_errs;
@@ -2557,9 +2557,9 @@ MdiWrite (
Routine Description:
This routine will write a value to the specified MII register
- of an external MDI compliant device (e.g. PHY 100). The command will
+ of an external MDI compliant device (e.g. PHY 100). The command will
execute in polled mode.
-
+
Arguments:
AdapterInfo - pointer to the structure that contains the NIC's context.
RegAddress - The MII register that we are writing to
@@ -2567,13 +2567,13 @@ Arguments:
DataValue - The value that we are writing to the MII register.
Returns:
- nothing
+ nothing
--*/
{
UINT32 WriteCommand;
WriteCommand = ((UINT32) DataValue) |
- ((UINT32)(RegAddress << 16)) |
+ ((UINT32)(RegAddress << 16)) |
((UINT32)(PhyAddress << 21)) |
((UINT32)(MDI_WRITE << 26));
@@ -2589,7 +2589,7 @@ Returns:
//
// poll for the mdi write to complete
- while ((InLong (AdapterInfo, AdapterInfo->ioaddr + SCBCtrlMDI) &
+ while ((InLong (AdapterInfo, AdapterInfo->ioaddr + SCBCtrlMDI) &
MDI_PHY_READY) == 0){
DelayIt (AdapterInfo, 20);
}
@@ -2608,7 +2608,7 @@ Routine Description:
This routine will read a value from the specified MII register
of an external MDI compliant device (e.g. PHY 100), and return
it to the calling routine. The command will execute in polled mode.
-
+
Arguments:
AdapterInfo - pointer to the structure that contains the NIC's context.
RegAddress - The MII register that we are reading from
@@ -2616,7 +2616,7 @@ Arguments:
DataValue - pointer to the value that we read from the MII register.
Returns:
-
+
--*/
{
UINT32 ReadCommand;
@@ -2655,19 +2655,19 @@ PhyReset (
Routine Description:
This routine will reset the PHY that the adapter is currently
- configured to use.
-
+ configured to use.
+
Arguments:
AdapterInfo - pointer to the structure that contains the NIC's context.
Returns:
-
+
--*/
{
UINT16 MdiControlReg;
- MdiControlReg = (MDI_CR_AUTO_SELECT |
- MDI_CR_RESTART_AUTO_NEG |
+ MdiControlReg = (MDI_CR_AUTO_SELECT |
+ MDI_CR_RESTART_AUTO_NEG |
MDI_CR_RESET);
//
@@ -2721,14 +2721,14 @@ Routine Description:
this range.
6. Driver ignores FORCEFDX and SPEED overrides if a 503 interface
is detected.
-
+
Arguments:
AdapterInfo - pointer to the structure that contains the NIC's context.
Returns:
TRUE - If a Phy was detected, and configured correctly.
- FALSE - If a valid phy could not be detected and configured.
-
+ FALSE - If a valid phy could not be detected and configured.
+
--*/
{
UINT16 *eedata;
@@ -2788,7 +2788,7 @@ Returns:
&MdiStatusReg
);
- if (!((MdiControlReg == 0xffff) ||
+ if (!((MdiControlReg == 0xffff) ||
((MdiStatusReg == 0) && (MdiControlReg == 0)))) {
//
@@ -3030,9 +3030,9 @@ Arguments:
Returns:
TRUE - If the phy could be configured correctly
- FALSE - If the phy couldn't be configured correctly, because an
+ FALSE - If the phy couldn't be configured correctly, because an
unsupported over-ride option was used
-
+
--*/
{
UINT16 MdiControlReg;
@@ -3258,7 +3258,7 @@ Returns:
// value accordingly
//
AdapterInfo->LinkSpeed = AdapterInfo->LinkSpeedReq;
- AdapterInfo->Duplex = (UINT8) ((AdapterInfo->DuplexReq & PXE_FORCE_FULL_DUPLEX) ?
+ AdapterInfo->Duplex = (UINT8) ((AdapterInfo->DuplexReq & PXE_FORCE_FULL_DUPLEX) ?
FULL_DUPLEX : HALF_DUPLEX);
//
@@ -3363,7 +3363,7 @@ Returns:
// advertised ablilities, and then assuming that the highest common
// denominator was chosed by NWAY.
//
- if ((MdiLinkPartnerAdReg & NWAY_LP_ABILITY) &&
+ if ((MdiLinkPartnerAdReg & NWAY_LP_ABILITY) &&
(MdiStatusReg & MDI_SR_AUTO_NEG_COMPLETE)) {
//
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index 98df75d..cc86971 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -29,6 +29,7 @@ Abstract:
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
#define NET_PROTO_HDR(Buf, Type) ((Type *) ((Buf)->BlockOp[0].Head))
@@ -416,13 +417,13 @@ IpIoCreateSndEntry (
//
// Set the fields of OverrideData
//
- *OverrideData = * (EFI_IP4_OVERRIDE_DATA *) Override;
+ NetCopyMem (OverrideData, Override, sizeof (*OverrideData));
}
//
// Set the fields of TxData
//
- EFI_IP4 (TxData->DestinationAddress) = Dest;
+ NetCopyMem (&TxData->DestinationAddress, &Dest, sizeof (EFI_IPv4_ADDRESS));
TxData->OverrideData = OverrideData;
TxData->OptionsLength = 0;
TxData->OptionsBuffer = NULL;
@@ -761,7 +762,6 @@ IpIoOpen (
{
EFI_STATUS Status;
EFI_IP4_PROTOCOL *Ip;
- EFI_IPv4_ADDRESS ZeroIp;
if (IpIo->IsConfigured) {
return EFI_ACCESS_DENIED;
@@ -782,8 +782,7 @@ IpIoOpen (
// (0.0.0.0, 0.0.0.0, 0.0.0.0). Delete this statement if Ip modified
// its code
//
- EFI_IP4 (ZeroIp) = 0;
- Status = Ip->Routes (Ip, TRUE, &ZeroIp, &ZeroIp, &ZeroIp);
+ Status = Ip->Routes (Ip, TRUE, &mZeroIp4Addr, &mZeroIp4Addr, &mZeroIp4Addr);
if (EFI_ERROR (Status) && (EFI_NOT_FOUND != Status)) {
return Status;
@@ -1147,8 +1146,8 @@ IpIoConfigIp (
Ip4ConfigData->SubnetMask = Ip4ModeData.ConfigData.SubnetMask;
}
- IpInfo->Addr = EFI_IP4 (Ip4ConfigData->StationAddress);
- IpInfo->SubnetMask = EFI_IP4 (Ip4ConfigData->SubnetMask);
+ NetCopyMem (&IpInfo->Addr, &Ip4ConfigData->StationAddress, sizeof (IP4_ADDR));
+ NetCopyMem (&IpInfo->SubnetMask, &Ip4ConfigData->SubnetMask, sizeof (IP4_ADDR));
Status = Ip->Receive (Ip, &IpInfo->DummyRcvToken);
if (EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
index c797952..c844a84 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
@@ -46,6 +46,7 @@
DebugLib
UefiBootServicesTableLib
MemoryAllocationLib
+ BaseMemoryLib
[Protocols]
gEfiIp4ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
index b66348c..d56456a 100644
--- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
+++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.c
@@ -30,6 +30,7 @@ Abstract:
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <library/BaseMemoryLib.h>
STATIC
VOID
@@ -77,6 +78,7 @@ UdpIoWrapTx (
EFI_UDP4_TRANSMIT_DATA *UdpTxData;
EFI_STATUS Status;
UINT32 Count;
+ IP4_ADDR Ip;
Token = NetAllocatePool (sizeof (UDP_TX_TOKEN) +
sizeof (EFI_UDP4_FRAGMENT_DATA) * (Packet->BlockOpNum - 1));
@@ -116,15 +118,21 @@ UdpIoWrapTx (
UdpTxData->GatewayAddress = NULL;
if (EndPoint != NULL) {
- EFI_IP4 (Token->UdpSession.SourceAddress) = HTONL (EndPoint->LocalAddr);
- EFI_IP4 (Token->UdpSession.DestinationAddress) = HTONL (EndPoint->RemoteAddr);
- Token->UdpSession.SourcePort = EndPoint->LocalPort;
- Token->UdpSession.DestinationPort = EndPoint->RemotePort;
- UdpTxData->UdpSessionData = &Token->UdpSession;
+ Ip = HTONL (EndPoint->LocalAddr);
+ NetCopyMem (&Token->UdpSession.SourceAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
+
+ Ip = HTONL (EndPoint->RemoteAddr);
+ NetCopyMem (&Token->UdpSession.DestinationAddress, &Ip, sizeof (EFI_IPv4_ADDRESS));
+
+ Token->UdpSession.SourcePort = EndPoint->LocalPort;
+ Token->UdpSession.DestinationPort = EndPoint->RemotePort;
+ UdpTxData->UdpSessionData = &Token->UdpSession;
}
if (Gateway != 0) {
- EFI_IP4 (Token->Gateway) = HTONL (Gateway);
+ Ip = HTONL (Gateway);
+ NetCopyMem (&Token->Gateway, &Ip, sizeof (EFI_IPv4_ADDRESS));
+
UdpTxData->GatewayAddress = &Token->Gateway;
}
@@ -670,11 +678,14 @@ UdpIoOnDgramRcvd (
}
UdpSession = &UdpRxData->UdpSession;
- Points.LocalAddr = EFI_NTOHL (UdpSession->DestinationAddress);
Points.LocalPort = UdpSession->DestinationPort;
- Points.RemoteAddr = EFI_NTOHL (UdpSession->SourceAddress);
Points.RemotePort = UdpSession->SourcePort;
+ NetCopyMem (&Points.LocalAddr, &UdpSession->DestinationAddress, sizeof (IP4_ADDR));
+ NetCopyMem (&Points.RemoteAddr, &UdpSession->SourceAddress, sizeof (IP4_ADDR));
+ Points.LocalAddr = NTOHL (Points.LocalAddr);
+ Points.RemoteAddr = NTOHL (Points.RemoteAddr);
+
Token->CallBack (Netbuf, &Points, EFI_SUCCESS, Token->Context);
ON_EXIT:
diff --git a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
index 32ccb96..7a20e80 100644
--- a/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+++ b/MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
@@ -46,6 +46,7 @@
DebugLib
UefiBootServicesTableLib
MemoryAllocationLib
+ BaseMemoryLib
[Protocols]
gEfiUdp4ServiceBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
index 903494e..28082db 100644
--- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
+++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Support.c
@@ -305,11 +305,16 @@ Mtftp4SendRequest (
Packet->OpCode = HTONS (Instance->Operation);
Cur = Packet->Rrq.Filename;
Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Token->Filename);
+ Cur += AsciiStrLen ((CHAR8 *) Token->Filename);
Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Mode);
+ Cur += AsciiStrLen ((CHAR8 *) Mode);
for (Index = 0; Index < Token->OptionCount; ++Index) {
- Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr);
- Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr);
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].OptionStr);
+ Cur += AsciiStrLen ((CHAR8 *) Options[Index].OptionStr);
+
+ Cur = (UINT8 *) AsciiStrCpy ((CHAR8 *) Cur, (CHAR8 *) Options[Index].ValueStr);
+ Cur += AsciiStrLen ((CHAR8 *) (CHAR8 *) Options[Index].ValueStr);
}
return Mtftp4SendPacket (Instance, Nbuf);
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
index 0b845ee..a6a6913 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c
@@ -707,6 +707,8 @@ Tcp4Dispatcher (
return Tcp4Route (Tcb, (TCP4_ROUTE_INFO *) Data);
+ default:
+ return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;